private void OnMenuSceneLoaded() { var pointer = Resources.FindObjectsOfTypeAll <VRPointer>().First(); if (pointer == null) { return; } if (_moverPointer) { _moverPointer.wasMoved -= ScreenWasMoved; Destroy(_moverPointer); } _moverPointer = pointer.gameObject.AddComponent <MoverPointer>(); _moverPointer.Init(screen.transform); _moverPointer.wasMoved += ScreenWasMoved; if (currentVideo != null) { PrepareVideo(currentVideo); } PauseVideo(); HideScreen(); }
private void OnGameSceneLoaded() { var pointer = Resources.FindObjectsOfTypeAll <VRPointer>().Last(); if (pointer == null) { return; } if (_moverPointer) { _moverPointer.wasMoved -= ScreenWasMoved; Destroy(_moverPointer); } _moverPointer = pointer.gameObject.AddComponent <MoverPointer>(); _moverPointer.Init(screen.transform); _moverPointer.wasMoved += ScreenWasMoved; if (videoPlayer.time != offsetSec) { // game was restarted if (currentVideo.offset >= 0) { videoPlayer.time = offsetSec; } else { videoPlayer.time = 0; } } PlayVideo(); }
private void OnGameSceneLoaded() { var pointer = Resources.FindObjectsOfTypeAll <VRPointer>().Last(); Console.WriteLine("Pointer " + pointer?.name); if (pointer == null) { return; } if (_moverPointer) { _moverPointer.wasMoved -= ScreenWasMoved; Destroy(_moverPointer); } _moverPointer = pointer.gameObject.AddComponent <MoverPointer>(); _moverPointer.Init(screen.transform); _moverPointer.wasMoved += ScreenWasMoved; PlayVideo(); }