{"record":{"id":"ceb484b4d6aeb47f","repo":"BabylonJS/Babylon.js","slug":"framegraphcullobjectstask-this-name-objectlist","errorCode":null,"errorMessage":"FrameGraphCullObjectsTask ${this.name}: objectList and camera are required","messagePattern":"FrameGraphCullObjectsTask (.+?): objectList and camera are required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/Misc/cullObjectsTask.ts","lineNumber":46,"sourceCode":"     * @param frameGraph The frame graph the task belongs to.\r\n     * @param scene The scene to cull objects from.\r\n     */\r\n    constructor(name: string, frameGraph: FrameGraph, scene: Scene) {\r\n        super(name, frameGraph);\r\n        this._scene = scene;\r\n        this.outputObjectList = {\r\n            meshes: null,\r\n            particleSystems: null,\r\n        };\r\n    }\r\n\r\n    public override getClassName(): string {\r\n        return \"FrameGraphCullObjectsTask\";\r\n    }\r\n\r\n    public record() {\r\n        if (this.objectList === undefined || this.camera === undefined) {\r\n            throw new Error(`FrameGraphCullObjectsTask ${this.name}: objectList and camera are required`);\r\n        }\r\n\r\n        // Initial output values\r\n        this.outputObjectList.meshes = this.objectList.meshes;\r\n        this.outputObjectList.particleSystems = this.objectList.particleSystems;\r\n\r\n        const pass = this._frameGraph.addObjectListPass(this.name);\r\n\r\n        pass.setObjectList(this.outputObjectList);\r\n        pass.setExecuteFunc((_context) => {\r\n            // No culling on particle systems\r\n            this.outputObjectList.particleSystems = this.objectList.particleSystems;\r\n\r\n            if (this._scene._activeMeshesFrozen) {\r\n                // If active meshes are frozen, we don't need culling: we keep the last list created before freezing\r\n                return;\r\n            }\r\n\r","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/Misc/cullObjectsTask.ts#L28-L64","documentation":"FrameGraphCullObjectsTask performs frustum culling of an object list relative to a camera, so both inputs are mandatory. record() throws when either task.objectList or task.camera is undefined before producing the culled outputObjectList.","triggerScenarios":"Calling cullObjectsTask.record() (directly or via frame graph build) without having set task.objectList or task.camera.","commonSituations":"Constructing the task and forgetting to wire the camera handle from a camera task output; passing an object list that was never produced by a preceding task; partially migrated legacy scene-culling code.","solutions":["Set task.objectList to the output of a preceding FrameGraphObjectListTask (or a valid object list handle) before record().","Set task.camera to a camera task's output handle.","Check task execution order: the tasks producing objectList and camera must be recorded/built before the cull task."],"exampleFix":"// before\nconst cullTask = new FrameGraphCullObjectsTask(\"cull\", context);\ncontext.build();\n// after\nconst cullTask = new FrameGraphCullObjectsTask(\"cull\", context);\ncullTask.objectList = objectListTask.output;\ncullTask.camera = cameraTask.output;\ncontext.build();","handlingStrategy":"validation","validationCode":"if (cullTask.objectList === undefined || cullTask.camera === undefined) {\n  throw new Error(\"CullObjectsTask requires objectList and camera before build\");\n}","typeGuard":"function isCullTaskReady(task: FrameGraphCullObjectsTask): boolean {\n  return task.objectList !== undefined && task.camera !== undefined;\n}","tryCatchPattern":"try {\n  cullTask.record();\n} catch (e) {\n  if (String(e).includes(\"objectList and camera are required\")) {\n    console.error(\"Wire cullTask.objectList and cullTask.camera before building the graph\");\n  } else throw e;\n}","preventionTips":["Wire objectList from an object list task and camera from a camera task right after construction.","Keep task wiring and graph building in the same function so ordering mistakes are visible.","Review task inputs against the class docs before build()."],"tags":["frame-graph","culling","missing-input","validation"],"backgroundTag":"required-input-missing","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}