Use when binding code-driven TypeScript components in Cocos Creator scenes.
Installation
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Error 3817: Canvas component can only have one instance
Cause: WeChat Mini Game's Cocos engine automatically creates a Canvas during initialization. Adding a Canvas component manually in Scene JSON or via addComponent(Canvas) triggers this error.
Fix:
Do NOT put Canvas node in Scene JSON
Do NOT call this.node.addComponent(Canvas) in code
Let the Bootstrapper Component live on a plain Node (not Canvas)
All UI nodes are dynamically created children of the Bootstrapper node
Scene MUST have an entry Component
If the Scene JSON has no component that runs code, the scene loads but nothing executes. Console shows LoadScene ...: 20ms but no app logs.
Fix: Always ensure at least one node in Scene JSON has a Component that runs onLoad()/start().
id collision
If you use an __id__ already used by another object, Cocos will either crash or silently fail.
Best practice: Use high numbers (e.g., 15, 20) for manually-added components to avoid collision with auto-generated IDs (usually 0-14 for simple scenes).
Camera position for auto-created Camera
If your code dynamically creates a Camera (child of the Bootstrapper node), set z position to 1000:
camNode.setPosition(v3(0, 0, 1000));
Otherwise the camera might be behind or inside the scene geometry.