Skip to main content
Inspiring
January 19, 2015

OVRMainMenu and GUI problem in Unity 4.6

Hey guys. Need a little help here.

Under Unity 4.6 with SDK 0.4.4 when I load the main menu gui (hit spacebar by default) I get this yellow warning:

Parent of RectTransform is being set with parent property. Consider using the SetParent method instead, with the worldPositionStays argument set to false. This will retain local orientation and scale rather than world orientation and scale, which can prevent common UI scaling issues.
UnityEngine.Transform:set_parent(Transform)
OVRUGUI:UIObjectManager(GameObject, String, Single, String, Int32) (at Assets/OVR/Scripts/Util/OVRUGUI.cs:248)
OVRUGUI:InitUIComponents() (at Assets/OVR/Scripts/Util/OVRUGUI.cs:235)
OVRUGUI:UpdateGUI() (at Assets/OVR/Scripts/Util/OVRUGUI.cs:120)
OVRMainMenu:Update() (at Assets/OVR/Scripts/Util/OVRMainMenu.cs:412)


Then if I load another scene, the menu no longer works. Which means I can't even hit escape to exit the game.
I get this red error in the editor repeating constantly:

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.
OVRUGUI.UpdateVariable () (at Assets/OVR/Scripts/Util/OVRUGUI.cs:132)
OVRUGUI.UpdateGUI () (at Assets/OVR/Scripts/Util/OVRUGUI.cs:123)
OVRMainMenu.Update () (at Assets/OVR/Scripts/Util/OVRMainMenu.cs:412)


Looks like once I load it, it always checks in the same place when I load a new scene.. but it's been destroyed.
Sounds like it should be an easy fix.
Any pointers?

Thanks!
    This topic has been closed for replies.

    5 replies

    January 21, 2015
    I am experiencing the same problem. The menu only works in the first scene, every new scene (not additive) breaks the menu.

    Unity 4.6.1p4, SDK 4.4
    January 21, 2015
    See here for possible fix:

    viewtopic.php?f=37&t=18124
    Inspiring
    January 21, 2015
    "ronczarnik" wrote:
    See here for possible fix:

    viewtopic.php?f=37&t=18124


    Nope. No go. :(
    Same errors.

    I'll just go back to Unity 4.5 I guess. Not seeing FPS makes optimizing hard.
    IRIS VR - TECHNOLUST - KERSER - BODY/MIND/CHANGE - QUANTUM CAPTURE - OCCUPIED VR
    New Participant
    January 21, 2015
    This should fix it...

    Add this method to OVRUGUI:

    public static void ResetGUI()
    {
    isInited = false;
    }



    Then add the following line at the beginning of the Awake method of OVRMainMenu.

    OVRUGUI.ResetGUI();


    Note this will only work if OVRMainMenu is on an object which you haven't mark as DontDestoryOnLoad.
    Inspiring
    January 22, 2015
    Amazing! Totally fixed it. Thanks Andy. You da man :)
    IRIS VR - TECHNOLUST - KERSER - BODY/MIND/CHANGE - QUANTUM CAPTURE - OCCUPIED VR