Sure. Just a simple example:
public class TestViveProEye
{
private Vector3 leftOrigin;
public void StartUpdateData()
{
SRanipal_Eye.WrapperRegisterEyeDataCallback(Marshal.GetFunctionPointerForDelegate((SRanipal_Eye.CallbackBasic) UpdateData));
}
public void StopUpdateData()
{
SRanipal_Eye.WrapperUnRegisterEyeDataCallback(Marshal.GetFunctionPointerForDelegate((SRanipal_Eye.CallbackBasic) UpdateData));
}
private void UpdateData(ref EyeData eyeData)
{
//Works as expected
Debug.Log(eyeData.verbose_data.left.gaze_origin_mm);
//Throws NullReferenceException: Object reference not set to an instance of an object
//UnityEngine.UnhandledExceptionHandler:<RegisterUECatcher>m__0(Object, UnhandledExceptionEventArgs)
leftOrigin = eyeData.verbose_data.left.gaze_origin_mm;
Debug.Log(leftOrigin);
}
}
It is odd. Storing the eye tracking values locally or passing it to other functions causes a NullReferenceException. However, printing the value to the console works just fine. Maybe I'm missing something on the scope of the callback function(UpdateData), but I'm not sure.