StefanPezzei Posted September 24, 2020 Posted September 24, 2020 Hi @PavelP and @Corvus, I get the same problem as @PavelP. After a few seconds, the NullReferenceException with System.Buffer.memcpy4 is thrown. After the exception Unity freezes and needs to be closed by the task manager. Tested with: Unity 2019.2.17f1 and 2020.1.6f1 SteamVR 1.13.10 SRanipal_SDK_1.1.0.1 Has someone found a solution?
Corvus Posted September 24, 2020 Posted September 24, 2020 @StefanPezzei Can you share a code snippet or are you using the sample code I provided?
StefanPezzei Posted September 25, 2020 Posted September 25, 2020 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.
StefanPezzei Posted September 30, 2020 Posted September 30, 2020 @Corvus to give you more information. same problem persists with: SRanipal 1.3.0.9 SRanipal Framework Version 2 For the first 70-200 frames (changes each time when registering the callback function) the callback function works fine and as intended. After the first few hundred frames, the NullReferenceException is thrown each following frame. Unregistering and reregistering the callback function repeats the described behavior. best, Stefan
StefanPezzei Posted October 1, 2020 Posted October 1, 2020 I found a workaround. Making the variable static solves the problem.
prajaktakhandve Posted November 7, 2020 Posted November 7, 2020 @imarin18 Hello, Thank you for your comments, we have been trying to use the two scripts for getting data at 120 Hz but our unity freezes when we try to implement the solutions above. Please could you elaborate on your second point, what do you mean by adding another counter in the while loop? Thanks!
imarin18 Posted January 5, 2021 Posted January 5, 2021 Dear @prajaktakhandve I'm sorry for my late response. I could not get the notification from this thread. I recommend referring to the following research paper: https://doi.org/10.3389/fpsyt.2020.572938. The authors open the source code on GitHub: https://github.com/MotorControlLearning/SaccadeVR-mobile. Best regards, imarin18
Playnary Posted December 8, 2021 Posted December 8, 2021 Had the same freeze problem and followed imarin18' advice. Here's how they solve it exactly:
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now