Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Welby's avatar
Welby
Adventurer
11 years ago

Crash when showing the FPS dialog

I'm having a weird issue.

I've Unity 4.6 and Oculus SDK 4.4..

If i load from the editor a specific level that we can call for now "A level" everything is fine..

But i have a script in another level (called: B level )that simply load on trigger the A level.

What happens is that everything is ok but when i press the key to show the Fps,the game/editor crash. I've this error: MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. It seems that this error was happen on the 132 line of OVRGUI.

I haven't modified the OVRGUI at all. I hadn't this issue before.. i don't know what it happen now..

Some helps?

12 Replies

Replies have been turned off for this discussion
  • hmlee's avatar
    hmlee
    Honored Guest
    Adding following code in OVRMainMenu.cs will fix your problem for now.

     void OnDestroy()
    {
    OVRUGUI.isInited = false;
    }
  • "vrdaveb" wrote:
    Does it help to add the following constructor to OVRUGUI.cs?
    	OVRUGUI()
    {
    isInited = false;
    }


    This hadn't help at all,still have the crashes. But this is supposed to be a bug that will be fixed in the next SDK or what?

    "hmlee" wrote:
    Adding following code in OVRMainMenu.cs will fix your problem for now.

     void OnDestroy()
    {
    OVRUGUI.isInited = false;
    }


    I can't put this code in the OVRMainMenu due to private privileges so i can't use OVRUGUI.isInited in OVRMainMenu because is private

    Edit: Alright.. i've tried the solution of Vrdaveb and it seems to work. Honestly in the editor the game still crashed.. but in the build now everything is fine and the fps dialog too.

    Thanks!