WaveVR API Usage in Life Cycle

Introduction

The Unity application has a life cycle, so developers need to check different conditions when using some APIs to get information if they don’t want to check at every frame (check in Update()).

E.g. Developers should consider following conditions when using WVR_GetInputMappingTable to bring up a button mapping table:

private const uint inputTableSize = 10;
private WVR_InputMappingPair_t[] inputTable = new WVR_InputMappingPair_t[inputTableSize];

// Check mapping table in Start()
void Start()
{
    uint ucount = Interop.WVR_GetInputMappingTable (WVR_DeviceType.WVR_DeviceType_Controller_Right, this.inputTable, inputTableSize);
}

// Check mapping table when AP resumes.
void OnApplicationPause(bool pauseStatus)
{
    if (!pauseStatus)
    {
        uint ucount = Interop.WVR_GetInputMappingTable (WVR_DeviceType.WVR_DeviceType_Controller_Right, this.inputTable, inputTableSize);
    }
}

    // Check when receiving specified event.
void OnEnable()
{
    WaveVR_Utils.Event.Listen (WVR_EventType.WVR_EventType_TouchUntapped.ToString(), OnEvent);
}

void OnDisable()
{
    WaveVR_Utils.Event.Remove (WVR_EventType.WVR_EventType_TouchUntapped.ToString(), OnEvent);
}

void OnEvent(params object[] args)
{
    ucount = Interop.WVR_GetInputMappingTable (WVR_DeviceType.WVR_DeviceType_Controller_Right, this.inputTable, inputTableSize);
}