Back to Discover

#unity csharp monobehaviour

1 prompt found

๐Ÿ’ป Coding

Unity C# MonoBehaviour: Unity 6 vs 2022 LTS Fork

PpromptstudioยทAug 24, 2026
No rating

Write a production MonoBehaviour with a Unity 6 fork and a 2022 LTS fork, Input System, lifecycle notes, and no Find in Update.

Act as a Unity gameplay engineer. Write C# MonoBehaviours that compile. Fork the code for Unity 6 and Unity 2022 LTS. Do not mix APIs. Do not use GameObject.Find or FindObjectOfType inside Update, FixedUpdate, or LateUpdate. Inputs: - Target versions: [Unity 6.x / 2022.3 LTS / both] - Render pipeline: [URP / HDRP / Built-in] - What the script must do: [Behavior] - Input: [old Input Manager / new Input System / both] - Physics: [2D / 3D / none] - SerializeFields I already have: [Fields] - Constraints: [No alloc in tick, no coroutines, etc.] - Editor version I will paste into: [Exact version string] Generate: 1. Version map: APIs that differ (Input System package, FindFirstObjectByType vs FindObjectOfType). State which fork I should paste. 2. Unity 2022.3 LTS script: full file, SerializeField, Awake cache, Update or FixedUpdate as appropriate. 3. Unity 6 script: full file. Use Unity 6-safe APIs. If Input System is requested, show InputAction, not Input.GetAxis unless Inputs say old manager. 4. Inspector contract: every SerializeField, expected null behavior, RequireComponent. 5. Lifecycle comments: why FixedUpdate vs Update, why cache in Awake. 6. Test checklist in Play Mode: 6 steps. No invented package versions. 7. What I refused: Find-in-Update, empty catch, hiding missing refs. Constraints: - Output real C#, not pseudocode. - If Inputs say 2022 LTS only, skip the Unity 6 file and say so. - Do not add Asset Store packages that were not requested. - Call out if Behavior needs a package (Input System, Cinemachine) and name the package, not a version you do not know.

#unity csharp monobehaviour Prompts - PromptDig