Skip to main content
Participant
December 15, 2014

Dynamically instantiating OVRPlayerController causes crash

We have a number of different Player/camera rig prefabs that we use while developing and had been instantiating one of them dynamically on startup based on need.

However in the 0.4.3 and 0.4.4 SDKs attempting to instantiate the OVRPlayerController prefab dynamically causes the Unity Editor to crash.

I can work around this by having the OVR Player already exist in the serialised scene rather than being dynamically instantiated, but it is an ugly hack.

I can recreate this crash in an new empty project by importing the OVR package, then adding and setting up a single gameobject with the following behaviour:


using UnityEngine;
using System.Collections;

public class PlayerSpawner : MonoBehaviour {

public int DelayFrames = 0;
public GameObject PlayerPrefab;

private int m_FrameCount = 0;

// Update is called once per frame
void Update () {
if (m_FrameCount++ == DelayFrames) {
Instantiate(PlayerPrefab, transform.position, transform.rotation);
}
}
}


Crash Callstack:


========== OUTPUTING STACK TRACE ==================

(0x60861A91) (OculusPlugin): (filename not available): (function-name not available) + 0x0
(0x6086192C) (OculusPlugin): (filename not available): (function-name not available) + 0x0
(0x6086325E) (OculusPlugin): (filename not available): UnityRenderEvent + 0xce
(0x007BE927) c:\buildagent\work\d63dfc6385190b60\runtime\misc\plugins.cpp (154 + 0x0): PluginsRenderMarker + 0x47
(0x006B663C) c:\buildagent\work\d63dfc6385190b60\runtime\gfxdevice\gfxdevice.cpp (957 + 0x9): GfxDevice::InsertCustomMarker + 0xc
(0x010FF976) c:\buildagent\work\d63dfc6385190b60\runtime\gfxdevice\threaded\gfxdeviceworker.cpp (1277 + 0x0): GfxDeviceWorker::RunCommand + 0x3596
(0x01102F91) c:\buildagent\work\d63dfc6385190b60\runtime\gfxdevice\threaded\gfxdeviceworker.cpp (215 + 0x14): GfxDeviceWorker::RunGfxDeviceWorker + 0x51
(0x009097AD) c:\buildagent\work\d63dfc6385190b60\runtime\threads\thread.cpp (40 + 0x9): Thread::RunThreadWrapper + 0x2d
(0x763F338A) (kernel32): (filename not available): BaseThreadInitThunk + 0x12
(0x77AC9F72) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x63
(0x77AC9F45) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x36
Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 0.073771 seconds (Nothing changed)
    This topic has been closed for replies.

    1 reply

    Inspiring
    December 16, 2014
    Does it help to rename OVRManager.Start to OVRManager.OnEnable?