Unity C# Scripting
Paste the following prompt into your AI chat to install this skill:
Please install @user_3c6cb52e/unity-csharp-scripting-sh-hsr42w by following https://skillhub.cn/install/skillhub.md.
About this skill
Problem
Many MonoBehaviour bugs are not logic errors but misplaced plumbing: calling GetComponent in Update, moving rigidbodies outside FixedUpdate, exposing public fields to the Inspector, or losing coroutines when GameObjects are disabled. This skill targets Unity 6 (6000.0 LTS) with C# / .NET Standard 2.1, helping authors write deterministic, debuggable gameplay scripts.
How it works
- Pick callbacks by purpose:
Awakefor cached references,OnEnablefor subscriptions,Startfor cross-object initialization,Updatefor per-frame logic,FixedUpdatefor physics,LateUpdatefor camera follow,OnDisable/OnDestroyfor cleanup. - Access components safely: cache lookups in
Awakeand useTryGetComponentwhen a reference may be missing. - Expose Inspector fields deliberately: prefer
[SerializeField] privateover public fields so designers can tune values without scripts mutating them. - Sequence time-based logic reliably: scale per-frame changes by
Time.deltaTimeand useStartCoroutinefor delays or multi-step behaviour with deterministic stopping.
Boundaries
This skill owns script lifecycle and C# plumbing, not rigidbody collisions, input reading, ScriptableObject config, or Animator parameters. Use the corresponding Unity subsystem skills for physics, input, shared data, or animation-driven behaviour.
Use Cases
- In a Unity 6 character component, choose Awake, Update, and FixedUpdate callbacks, then cache Transform references.
- Change public tunables to [SerializeField] private so the Inspector stays editable while external scripts cannot mutate them.
- Implement a click reward with a 1-second coroutine delay and restart it in OnEnable after GameObject enable toggling.
- Replace per-frame GetComponent calls and gameObject.tag string comparisons in hot paths with cached refs and CompareTag.
Best For
- Client engineers owning Unity character behaviour scripts who want deterministic lifecycle and component caching rules.
- Game designers maintaining Inspector panels who need clear field exposure without accidental mutation from other scripts.
- Unity developers fixing lost coroutines and physics jitter in legacy projects who want to retime logic by correct callbacks.
- Game tech leads reviewing Unity 6 C# code who need to check Update performance, serialization, and component access rules.
Related Skills
Automatically indexes Gradle-cached AAR/JAR dependency classes and returns library coordinates, versions, and public APIs by fully qualified name, using only the Python standard library.
Codifies AMT and YourMT3 training conventions, script patterns, hyperparameters, precision, checkpoints, and NaN safeguards.
Retrieve relevant chunks from a customer-managed PKM dataset by dataset_id and return concise, source-annotated answers.
Convert PRDs, user stories, or functional specs into prioritized test-point checklists covering functional, business-rule, boundary, exception, and non-functional dimensions.