/// <summary> /// Sets the main camera. /// </summary> static protected void SetDefaultCamera() { if (allCameras == null || allCameras.Count == 0) { Debug.LogError("No platform cameras found"); } // If there's only one camera assume it is the main regardless of settings. else if (allCameras.Count == 1) { defaultCamera = allCameras[0]; } else { int defaultCameraCount = 0; foreach (PlatformCamera camera in allCameras) { if (camera.isDefaultCamera) { defaultCamera = camera; defaultCameraCount++; } } if (defaultCameraCount != 1) { Debug.LogError("Expected 1 Default Camera but there were: " + defaultCameraCount); } } }
/// <summary> /// Adds a camera to the global list. /// </summary> /// <param name="platformCamera">Platform camera.</param> static protected void AddCamera(PlatformCamera platformCamera) { if (allCameras == null) { allCameras = new List <PlatformCamera>(); } allCameras.Add(platformCamera); }
/// <summary> /// Removes a camera from the global list. /// </summary> /// <param name="platformCamera">Platform camera.</param> static protected void RemoveCamera(PlatformCamera platformCamera) { if (defaultCamera == platformCamera) { defaultCamera = null; } if (allCameras != null) { if (allCameras.Contains(platformCamera)) { allCameras.Remove(platformCamera); } } }