protected override void DidActivate(bool firstActivation, ActivationType activationType) { _mirrorContainer = new GameObject(); base.DidActivate(firstActivation, activationType); if (firstActivation) { StartCoroutine(MirrorHelper.SpawnMirror(kMirrorPosition, kMirrorRotation, kMirrorScale, _mirrorContainer.transform)); } }
public void OnSceneLoaded(Scene newScene, LoadSceneMode mode) { if (_scenesManager == null) { _scenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); if (_scenesManager != null) { _scenesManager.transitionDidFinishEvent += sceneTransitionDidFinish; _scenesManager.transitionDidFinishEvent += SceneTransitionDidFinish; } } if (newScene.name == "MenuCore") { try { MenuButtons.instance.RegisterButton(new MenuButton("Avatars", () => { var mainFlowCoordinator = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First(); var flowCoordinator = new GameObject("AvatarListFlowCoordinator") .AddComponent <AvatarListFlowCoordinator>(); mainFlowCoordinator.InvokePrivateMethod("PresentFlowCoordinator", flowCoordinator, null, true, false); })); } catch (Exception) { logger.Warn("Failed to add menu button, spawning mirror instead"); _mirrorContainer = new GameObject(); GameObject.DontDestroyOnLoad(_mirrorContainer); SharedCoroutineStarter.instance.StartCoroutine(MirrorHelper.SpawnMirror(new Vector3(0, 0, -1.5f), Quaternion.Euler(-90f, 180f, 0), new Vector3(0.50f, 1f, 0.25f), _mirrorContainer.transform)); } } }