Skip to main content
Inspiring
December 15, 2014

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?
    This topic has been closed for replies.

    12 replies

    New Participant
    December 17, 2014
    Adding following code in OVRMainMenu.cs will fix your problem for now.

     void OnDestroy()
    {
    OVRUGUI.isInited = false;
    }
    WelbyAuthor
    Inspiring
    December 17, 2014
    "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!
    MIND LABYRINTH VR DREAMS MIND UNLEASHED