Skip to main content
Up and Coming
October 30, 2014

OVRManager Disappears when Spawning Prefab

I have been having some real problems with OVRManager. It's way more finicky than OVRDevice.

I have found that using 'Instantiate' and 'Network.Instantiate' to spawn ANY prefab with the OVRManager script it, spawns clones with the OVRManager component missing!

I have tried it with multiple OVRManager components in one game object, in different locations etc. Every time, I have found that in the clone, the OVRManager is simply stripped out.

Someone please help!

Just to make it clear, I have tested this in different scenes and even different projects. The result is the same. I have never seen this before

I am using Oclus SDK 0.4.3 on Unity 4.5.5p2.

Edit: I am aware I only need one OVRManager in a scene, and that it does not need to be attached to a camera controller/rig, and that I can just toggle it on and off. Never-the-less I would like to know what the cause of this might be.
    This topic has been closed for replies.

    3 replies

    Participant
    February 9, 2015
    I just wanted to say that this is still happening to me.

    And even if I try to do an AddComponent<OVRManager> after the gameobject is Instantiated, it mysteriously returns null and does not work.

    I've never run into this behavior in Unity before when adding components.
    Participant
    February 9, 2015
    Like many things in Unity, this seems to be caused by a "trying to do too many things in one Frame".

    OVRManager is a singleton class. Something inside of it prevents it from being added to more than one GameObject.

    If you try to Destroy and Spawn a new GameObject with a new OVRManager, then the GameObject will attempt to spawn before the old OVRManager is destroyed.

    My usual solution to situations like these, if I can get away with it, is to make my Spawn method a Coroutine and tell it to wait until end of frame.

    This guarantees that the Destroy call will resolve and that my Spawn method will work on the start of the next frame.
    Inspiring
    February 9, 2015
    I think you can try renaming the OVRManager function "Start" to "OnEnable". See if that helps.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV