unity-lifecycle
Installation
SKILL.md
Unity Lifecycle & Execution Order -- Correctness Patterns
Prerequisite skills:
unity-scripting(MonoBehaviour lifecycle, coroutines),unity-foundations(GameObjects, components)
These patterns target initialization bugs, null reference exceptions from destruction timing, and subtle editor-vs-runtime differences that cause "works in editor, fails in build" issues.
PATTERN: Fake-Null Trap (?. and ?? on Destroyed Objects)
WHEN: Null-checking Unity objects that may have been destroyed
WRONG (Claude default):
// C# null-conditional and null-coalescing bypass Unity's == override
myComponent?.DoSomething(); // May call method on destroyed object!
var fallback = myComponent ?? other; // May return a destroyed "fake-null" object!
Related skills