{"record":{"id":"6289e4a49f8a2652","repo":"stride3d/stride","slug":"unsupported-light-type","errorCode":null,"errorMessage":"Unsupported light type","messagePattern":"Unsupported light type","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/Images/LightShafts/LightShafts.cs","lineNumber":297,"sourceCode":"        }\n\n        private void UpdateRenderData(RenderDrawContext context, LightShaftRenderData data, RenderLightShaft lightShaft, LightShadowMapTexture shadowMapTexture)\n        {\n            if (lightShaft.Light2 is LightPoint)\n            {\n                data.GroupRenderer = new LightPointGroupRenderer();\n            }\n            else if (lightShaft.Light2 is LightSpot)\n            {\n                data.GroupRenderer = new LightSpotGroupRenderer();\n            }\n            else if (lightShaft.Light2 is LightDirectional)\n            {\n                data.GroupRenderer = new LightDirectionalGroupRenderer();\n            }\n            else\n            {\n                throw new InvalidOperationException(\"Unsupported light type\");\n            }\n\n            ILightShadowMapShaderGroupData shadowGroup = null;\n            if (shadowMapTexture != null)\n            {\n                data.ShadowType = shadowMapTexture.ShadowType;\n                data.ShadowMapRenderer = shadowMapTexture.Renderer;\n                shadowGroup = data.ShadowMapRenderer.CreateShaderGroupData(data.ShadowType);\n            }\n            else\n            {\n                data.ShadowType = 0;\n                data.ShadowMapRenderer = null;\n            }\n            data.ShaderGroup = data.GroupRenderer.CreateLightShaderGroup(context, shadowGroup);   // TODO: Implement support for texture projection and attenuation?\n        }\n\n        private void SetupLight(RenderDrawContext context, RenderLightShaft lightShaft, LightShadowMapTexture shadowMapTexture, ParameterCollection lightParameterCollection)","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/Images/LightShafts/LightShafts.cs#L279-L315","documentation":"UpdateRenderData (via SetupLight) only supports light shafts attached to SpotLight, PointLight, or LightDirectional components. Any other ILight implementation has no group renderer, so an InvalidOperationException('Unsupported light type') is thrown.","triggerScenarios":"Assigning a light shaft to a light whose runtime type is not LightDirectional (and not the spot/point cases handled earlier in the if/else chain) — e.g. a custom ILight subclass or an ambient/environment light.","commonSituations":"Users attaching the LightShaft component to the wrong light entity type in a scene, or writing a custom light type that LightShafts does not recognize.","solutions":["Attach the light shaft component only to spot, point, or directional lights","Check lightShaft.Light2.GetType() before enabling light shafts","Implement a custom group renderer if you must support a custom light type"],"exampleFix":"// before\nmyCustomLight.LightShaft = lightShaft; // throws\n// after\nif (light is LightDirectional || light is LightSpot || light is LightPoint)\n    myCustomLight.LightShaft = lightShaft;","handlingStrategy":"type-guard","validationCode":"if (!(light is LightDirectional || light is LightSpot || light is LightPoint))\n    return; // skip light shafts for this light","typeGuard":"bool SupportsLightShafts(ILight light) =>\n    light is LightDirectional || light is LightSpot || light is LightPoint;","tryCatchPattern":"try { SetupLight(lightShaft); }\ncatch (InvalidOperationException) { logger.Warning(\"Light shafts unsupported for this light type\"); }","preventionTips":["Only attach light shaft components to spot/point/directional lights","Check the light type at editor/composition time","Validate scene assets that reference custom light types"],"tags":["csharp","rendering","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}