public static CameraComponent GetCameraFromSlot(this RenderContext context, SceneCameraSlotIndex cameraSlotIndex) { var cameraCollection = SceneCameraSlotCollection.GetCurrent(context); if (cameraCollection == null) { return null; } // If no camera found, just skip this part. var camera = cameraCollection.GetCamera(cameraSlotIndex); return camera; }
/// <summary> /// Gets the camera for the specified slotIndex or null if empty /// </summary> /// <param name="cameraSlotIndex">The camera slotIndex.</param> /// <returns>SiliconStudio.Paradox.Engine.CameraComponent.</returns> public CameraComponent GetCamera(SceneCameraSlotIndex cameraSlotIndex) { int index = cameraSlotIndex; if (index >= 0 && index < Count) { var slot = this[index]; if (slot != null) { return(slot.Camera); } } return(null); }