Skip to content

Commit 8942e8b

Browse files
dsarnoclaude
andauthored
fix: close 2022.3 compile gap in UnityFindObjectsCompat.FindAll (#1106)
The (Type, bool includeInactive) overload guarded its modern-API branch with #elif UNITY_2023_1_OR_NEWER while the legacy reflection helper LegacyFindObjectsOfType is gated by #if !UNITY_2022_3_OR_NEWER. That left the entire Unity 2022.3.x band falling through to a legacy helper that the preprocessor had already excluded, producing CS0103: 'LegacyFindObjectsOfType' does not exist in the current context (e.g. on 2022.3.62f2, see #1105). The 3-arg FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode) overload has been available since Unity 2022.2, so 2022.3 can use the modern API directly. Aligning the threshold with the rest of the file (2022_3_OR_NEWER) closes the gap with no API loss. Closes #1105 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 56ee0b0 commit 8942e8b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

MCPForUnity/Runtime/Helpers/UnityFindObjectsCompat.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static UObject[] FindAll(Type type, bool includeInactive)
5858
#if UNITY_6000_5_OR_NEWER
5959
return UObject.FindObjectsByType(type,
6060
includeInactive ? UnityEngine.FindObjectsInactive.Include : UnityEngine.FindObjectsInactive.Exclude);
61-
#elif UNITY_2023_1_OR_NEWER
61+
#elif UNITY_2022_3_OR_NEWER
6262
return UObject.FindObjectsByType(type,
6363
includeInactive ? UnityEngine.FindObjectsInactive.Include : UnityEngine.FindObjectsInactive.Exclude,
6464
UnityEngine.FindObjectsSortMode.None);

0 commit comments

Comments
 (0)