public void SceneManager_activeSceneChanged(Scene from, Scene to) { var vrPointers = Resources.FindObjectsOfTypeAll <VRPointer>(); if (vrPointers.Count() == 0) { Plugin.Log("Failed to get VRPointer!"); return; } var _vrPointer = to.name != "GameCore" ? vrPointers.First() : vrPointers.Last(); if (_movePointer) { Destroy(_movePointer); } _movePointer = _vrPointer.gameObject.AddComponent <ChatMover>(); _movePointer.Init(_chatMoverCube); if (_lockPointer) { Destroy(_lockPointer); } _lockPointer = _vrPointer.gameObject.AddComponent <LockToggle>(); _lockPointer.Init(lockButtonImage, _lockButtonSphere); Plugin.Log($"{from.name} -> {to.name}"); }
public void SceneManager_activeSceneChanged(Scene from, Scene to) { var _vrPointer = to.name == "GameCore" ? Resources.FindObjectsOfTypeAll <VRPointer>().Last() : Resources.FindObjectsOfTypeAll <VRPointer>().First(); if (_vrPointer == null) { return; } if (_movePointer) { Destroy(_movePointer); } _movePointer = _vrPointer.gameObject.AddComponent <ChatMover>(); _movePointer.Init(_chatMoverCube); if (_lockPointer) { Destroy(_lockPointer); } _lockPointer = _vrPointer.gameObject.AddComponent <LockToggle>(); _lockPointer.Init(lockButtonImage, _lockButtonSphere); Plugin.Log($"ActiveSceneChanged! ({from.name} -> {to.name})"); }