FindObjectsSortMode is deprecated in Unity 6.5: drop the sort argument
Unity 6.5 deprecated every FindObjectsByType overload that takes a FindObjectsSortMode. Why InstanceID order is going away and the call to use instead.
- Status
- Obsolete since Unity 6.5 · Scripting
- Old
FindObjectsByType(..., FindObjectsSortMode)- New
FindObjectsByType<T>(), FindObjectsByType<T>(FindObjectsInactive)- Checked
- 2026-10-05, against the sources below
What changed
If you followed Unity 6.0's own advice and replaced FindObjectsOfType with FindObjectsByType(FindObjectsSortMode.None), Unity 6.5 now warns about that too. Every overload with a FindObjectsSortMode parameter is deprecated.
Unity's reason is that InstanceID will be replaced by EntityId, and the previous sort order cannot be maintained. Remove the sort argument. If your code depended on the InstanceID order, sort the array yourself by something your game controls, such as a spawn index.
Before and after
var pickups = FindObjectsByType<Pickup>(FindObjectsSortMode.None);
var all = FindObjectsByType<Pickup>(FindObjectsInactive.Include, FindObjectsSortMode.InstanceID);var pickups = FindObjectsByType<Pickup>();
var all = FindObjectsByType<Pickup>(FindObjectsInactive.Include);Fix it automatically
Paste a script into the Unity 6 Script Upgrade Checker and it applies this rename for you, along with the other safe fixes for your target version.
Open this example in the checkerQuestions
- In what order does FindObjectsByType return objects now?
- In no guaranteed order. If any of your code relied on the old InstanceID order, for example to pick the same spawn point each run, sort the array by something you control, such as a name or an index field.
- Is this a compile error?
- No. The sort-mode overloads are deprecated, so they still compile with a warning. Removing the argument clears the warning and is the same call on 6.5 and later.