private void CreateSpectatorViewRig(Transform parent) { HolographicCameraManager hcm = SV_Settings.Instance.HolographicCameraManager.GetComponent <HolographicCameraManager>(); if (hcm == null) { hcm = SV_Settings.Instance.HolographicCameraManager.AddComponent <HolographicCameraManager>(); } hcm.HolographicCameraIP = SV_Settings.Instance.SV_IP; hcm.LocalComputerIP = LocalComputerIP; SV_Settings.Instance.HolographicCameraManager = (GameObject)GameObject.Instantiate(SV_Settings.Instance.HolographicCameraManager, Vector3.zero, Quaternion.identity); SV_Settings.Instance.HolographicCameraManager.transform.parent = parent; }
public void EnableSpectatorView() { // Instantiate Anchor. if (!SV_Settings.Instance.Anchor.activeInHierarchy) { SV_Settings.Instance.Anchor = (GameObject)GameObject.Instantiate(SV_Settings.Instance.Anchor, Vector3.zero, Quaternion.identity); } SV_Settings.Instance.Anchor.SetActive(true); // Instantiate HolographicCameraManager. if (SpectatorView.HolographicCameraManager.Instance == null) { CreateSpectatorViewRig(null); } else { HolographicCameraManager hcm = SV_Settings.Instance.HolographicCameraManager.GetComponent <HolographicCameraManager>(); Transform parent = HolographicCameraManager.Instance.transform.parent; if (hcm == null) { Debug.LogWarning("Recreating HolographicCameraManager prefab since HolographicCameraManager script did not exist on original."); GameObject.DestroyImmediate(SpectatorView.HolographicCameraManager.Instance); CreateSpectatorViewRig(parent); } else { if (hcm.HolographicCameraIP != SV_Settings.Instance.SV_IP || hcm.LocalComputerIP != LocalComputerIP) { Debug.LogWarning("Recreating HolographicCameraManager prefab since IP's were incorrect on original."); // IP's are wrong, recreate rig. GameObject.DestroyImmediate(HolographicCameraManager.Instance); CreateSpectatorViewRig(parent); } } } SV_Settings.Instance.HolographicCameraManager.SetActive(true); }