Fix
Unity 6 obsolete FindObjectOfType and Input calls
Answer
In Unity 6 replace obsolete FindObjectOfType and FindObjectsOfType calls. Prefer a [SerializeField] reference or FindAnyObjectByType<T>() for any instance; read input through UnityEngine.InputSystem.
- Unity 6.3 LTS (6000.3.x), APIs checked against 6000.6 docs on 2026-10-15
- Input System com.unity.inputsystem (Unity 6 new-project default)
Last verified 2026-10-15
The Unity 6 pack pins Unity 6.3 LTS (6000.3.x), APIs checked against 6000.6 docs on 2026-10-15. Object.FindObjectOfType and FindObjectsOfType are obsolete in Unity 6. Unity 6000.3 docs name FindFirstObjectByType as the direct replacement, and the faster FindAnyObjectByType when any instance is fine.
The pack uses FindAnyObjectByType<T>(), valid on Unity 6.0 through 6.6. On Unity 6.6 and newer, FindFirstObjectByType is also obsolete because it depended on InstanceID ordering. For a specific object, use FindObjectsByType<T>() and sort by something real, such as sibling index. Prefer a [SerializeField] reference over any Find call. Expose designer fields with [SerializeField] private instead of public gameplay fields. Cache results in Awake or Start; never call Find, GetComponent, or Camera.main in Update.
Read input through the Input System package, UnityEngine.InputSystem. Input.GetAxis, Input.GetKey, and Input.GetButton throw when the project is set to the new Input System only, the Unity 6 default for new projects. Read buttons in Update and write to a Rigidbody in FixedUpdate. Null-check Keyboard.current and action references: they can be null when the device is missing or the domain reloads.
Unity 6 renamed Rigidbody.velocity to Rigidbody.linearVelocity. The old name is obsolete. linearVelocity is a world-space vector in units per second. Cache GetComponent<Rigidbody>() once. Use AddForce for ongoing motion and set linearVelocity only for an instant change such as a jump, rather than assigning it every physics step. The sample below is copied from the pack: it caches the body in Awake, reads input in Update, and applies the jump in FixedUpdate.
Last verified 2026-10-15. doc-verified.
Pro
Unity 6 Pro rules, $1+
$1+ · pay what you want
Netcode for GameObjects, URP and Shader Graph, Addressables, and the Test Runner. Deeper than the free Unity 6 pack.
Each pack ships as AGENTS.md, CLAUDE.md, Cursor .mdc, and Copilot instructions, with 12 months of free updates.
From the Unity 6 Pro rules
Mark an RPC with `[Rpc(SendTo.Server)]` and end the method name in `Rpc`. A missing `Rpc` suffix is an error. Do not write new `[ServerRpc]` or `[ClientRpc]` methods.
A client asks the server with `SendTo.Server`. The server talks to observers with `SendTo.NotServer`, or `SendTo.ClientsAndHost` when a host must run the method too. There is no direct client-to-client connection. The server forwards it.
Keep shared state on a `NetworkVariable<T>` and use `.Value`. It is sent to clients already connected and to a client that joins later. An RPC is not. Write `.Value` from the server when write permission is `NetworkVariableWritePermission.Server`.
Put a `NetworkObject` on the networked prefab and spawn it on the server. Do not use the removed UNet types `NetworkIdentity`, `[Command]`, or `UnityEngine.Networking`.Buy Pro — $1+Unity 6 pack — Unity 6 C# rules that refuse obsolete 2022 / UNet patterns. Input System defaults, current APIs, four files ready for Cursor, Claude, AGENTS.md, and Copilot.
doc-verified
Sample from the pack
The movement sample in the Unity 6 rules file.
using UnityEngine;
using UnityEngine.InputSystem;
public class Jumper : MonoBehaviour
{
[SerializeField] private float jumpSpeed = 6f;
private Rigidbody body;
private bool jumpPressed;
private void Awake()
{
body = GetComponent<Rigidbody>();
}
private void Update()
{
jumpPressed = Keyboard.current != null && Keyboard.current.spaceKey.wasPressedThisFrame;
}
private void FixedUpdate()
{
if (!jumpPressed) return;
body.linearVelocity = new Vector3(body.linearVelocity.x, jumpSpeed, body.linearVelocity.z);
jumpPressed = false;
}
}Sources in the pack
- unity.com/releases/unity-6/support
- docs.unity.com/en-us/engine/6000.0/manual/upgrade-guides/upgrade-guide-unity6
- docs.unity.com/en-us/engine/6000.6/script-reference/unityengine/rigidbody/linearvelocity
- docs.unity.com/en-us/engine/6000.6/manual/scripting/fundamental-unity-types/instanceid-to-entityid-migration
Questions
- What replaces obsolete FindObjectOfType and Input calls in Unity 6?
- In Unity 6 replace obsolete FindObjectOfType and FindObjectsOfType calls. Prefer a [SerializeField] reference or FindAnyObjectByType<T>() for any instance; read input through UnityEngine.InputSystem.
- Why does the pack avoid FindFirstObjectByType?
- Unity 6000.3 docs name it as the direct replacement, but it is also obsolete on Unity 6.6 and newer because it depended on InstanceID ordering. Use FindAnyObjectByType<T>() for any instance, or FindObjectsByType<T>() and sort by something real for a specific object.
- Why do Input.GetAxis, GetKey, and GetButton throw?
- They throw when the project uses the new Input System only, the Unity 6 default for new projects. Read input through UnityEngine.InputSystem instead.
- When was this Unity 6 rule last checked?
- Last verified 2026-10-15. doc-verified.