{"record":{"id":"47a28a60147630b9","repo":"stride3d/stride","slug":"the-camera-camera-entity-name-is-disabled-and-can-t-be","errorCode":null,"errorMessage":"The camera [{camera.Entity.Name}] is disabled and can't be attached","messagePattern":"The camera \\[(.+?)\\] is disabled and can't be attached","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Engine/Engine/Processors/CameraProcessor.cs","lineNumber":131,"sourceCode":"                    camera.Update();\n                }\n            }\n        }\n\n        protected override void OnEntityComponentRemoved(Entity entity, CameraComponent component, CameraComponent data)\n        {\n            if (component.Slot.AttachedCompositor != null)\n                DetachCameraFromSlot(component);\n        }\n\n        private void OnCameraSlotsChanged(object sender, ref FastTrackingCollectionChangedEventArgs e)\n        {\n            cameraSlotsDirty = true;\n        }\n\n        private void AttachCameraToSlot(GraphicsCompositor graphicsCompositor, CameraComponent camera)\n        {\n            if (!camera.Enabled) throw new InvalidOperationException($\"The camera [{camera.Entity.Name}] is disabled and can't be attached\");\n            if (camera.Slot.AttachedCompositor != null) throw new InvalidOperationException($\"The camera [{camera.Entity.Name}] is already attached\");\n\n            for (var i = 0; i < graphicsCompositor.Cameras.Count; ++i)\n            {\n                var slot = graphicsCompositor.Cameras[i];\n                if (slot.Id == camera.Slot.Id)\n                {\n                    if (slot.Camera != null)\n                        throw new InvalidOperationException($\"Unable to attach camera [{camera.Entity.Name}] to the graphics compositor. Another camera, [{slot.Camera.Entity.Name}], is enabled and already attached to this slot.\");\n\n                    slot.Camera = camera;\n                    camera.Slot.AttachedCompositor = graphicsCompositor;\n                    break;\n                }\n            }\n        }\n\n        private static void DetachCameraFromSlot(CameraComponent camera)","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Engine/Engine/Processors/CameraProcessor.cs#L113-L149","documentation":"CameraProcessor.AttachCameraToSlot throws InvalidOperationException when a CameraComponent with Enabled == false is offered for attachment to a GraphicsCompositor camera slot. Stride only allows enabled cameras to occupy compositor slots.","triggerScenarios":"Adding an entity whose CameraComponent.Enabled is false while its camera slot is being resolved during the Draw/processor pass; disabling a camera then forcing re-attachment (e.g. changing Slot or graphics compositor).","commonSituations":"Scene setup code that adds a camera entity but forgot camera.Enabled = true; spawning prefabs with cameras disabled by default; tooling that toggles camera enabled state before first frame.","solutions":["Set camera.Enabled = true before the entity is processed / first frame","Only add camera entities to the scene when they should be active","Guard attachment code with if (camera.Enabled) checks","If a camera should be temporarily off, detach it from the slot instead of disabling the component while attached"],"exampleFix":"// before\nvar camera = new CameraComponent { Slot = slotId }; // Enabled defaults false\nentity.Add(camera);\n// after\nvar camera = new CameraComponent { Slot = slotId, Enabled = true };\nentity.Add(camera);","handlingStrategy":"validation","validationCode":"if (!camera.Enabled) camera.Enabled = true; // or skip attaching","typeGuard":"bool CanAttach(CameraComponent c) => c != null && c.Enabled && c.Slot != null && c.Slot.AttachedCompositor == null;","tryCatchPattern":"try { AttachCameraToSlot(compositor, camera); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"is disabled\")) { /* skip or enable camera */ }","preventionTips":["Set Enabled = true on camera components used for rendering","Don't disable a camera while it occupies a slot; detach it instead","Validate camera setup in scene-loading code before first frame","Review prefabs for cameras disabled by default"],"tags":["graphics","camera","stride"],"backgroundTag":"invalid-state-transition","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}