-
Notifications
You must be signed in to change notification settings - Fork 12
Unity 6 Updates #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: unity-sdk-v2.0
Are you sure you want to change the base?
Unity 6 Updates #239
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
The PR updates deprecated Unity API calls and introduces a Unity version–guarded await path for web requests to resolve obsolete warnings in Unity 6000 and newer.
- Replaced all FindObjectOfType() usages with FindFirstObjectByType()
- Replaced all FindObjectsOfType() usages with FindObjectsByType(FindObjectsSortMode.None)
- Added a conditional await for UnityWebRequest.SendWebRequest under a new Unity version define
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
Runtime/Scripts/GameplayReferences.cs | Updated deprecated FindObjectOfType to FindFirstObjectByType |
Runtime/Scripts/Cognitive3D_Manager.cs | Updated FindObjectOfType to FindFirstObjectByType |
Runtime/Internal/NetworkManager.cs | Added conditional await for SendWebRequest on Unity 6000+ |
Runtime/ExitPoll/Scripts/PointerInputHandler.cs | Switched FindObjectsOfType to FindObjectsByType |
Runtime/ExitPoll/Scripts/MicrophoneButton.cs | Switched FindObjectOfType to FindFirstObjectByType |
Runtime/Components/OculusPassthrough.cs | Switched FindObjectOfType to FindFirstObjectByType |
Runtime/Components/OculusHardware.cs | Fixed casing for subsystemDescriptor.id |
Runtime/Components/Cognitive3D_MetaSceneMesh.cs | Updated FindObjectOfType to FindFirstObjectByType |
Runtime/ActiveSessionView/Editor/ActiveSessionViewEditor.cs | Switched FindObjectOfType to FindFirstObjectByType |
Editor/SceneSetupWindow.cs | Updated FindObjectOfType to FindFirstObjectByType |
Editor/ProjectSetupWindow.cs | Updated FindObjectOfType to FindFirstObjectByType |
Editor/ExportUtility.cs | Replaced FindObjectsOfType with FindObjectsByType |
Editor/ExitPollHolderInspector.cs | Switched FindObjectOfType to FindFirstObjectByType |
Editor/EditorCore.cs | Updated PlayerSettings define symbol API |
Editor/DynamicObjectsWindow.cs | Enhanced dynamic object retrieval to include disabled entries |
Editor/DynamicObjectInspector.cs | Switched FindObjectsOfType to FindObjectsByType |
Editor/DebugWindow.cs | Updated FindObjectOfType calls and define symbol API |
Comments suppressed due to low confidence (4)
Runtime/Internal/NetworkManager.cs:450
- Using async void prevents callers from awaiting this method and makes exception handling difficult. Change the signature to return Task to allow proper waiting and error propagation.
request.SetRequestHeader("Content-Type", "application/json");
Runtime/Internal/NetworkManager.cs:454
- The new await-based SendWebRequest branch under UNITY_6000_0_OR_NEWER introduces asynchronous behavior that should be covered by tests in both old and new Unity versions.
await request.SendWebRequest();
Editor/ExportUtility.cs:567
- [nitpick] Local variable 'SkinnedMeshes' is named with PascalCase, which conflicts with common C# conventions for local variables. Consider renaming to 'skinnedMeshes'.
SkinnedMeshRenderer[] SkinnedMeshes = UnityEngine.Object.FindObjectsByType<SkinnedMeshRenderer>(FindObjectsSortMode.None);
Editor/DynamicObjectsWindow.cs:617
- [nitpick] Repeatedly querying FindObjectsOfType can be expensive in large scenes. Consider caching results or limiting calls to improve responsiveness in the editor window.
_cachedDynamics = FindObjectsOfType<DynamicObject>();
@@ -450,8 +450,11 @@ internal async void Post(string url, string stringcontent) | |||
request.SetRequestHeader("Content-Type", "application/json"); | |||
request.SetRequestHeader("X-HTTP-Method-Override", "POST"); | |||
request.SetRequestHeader("Authorization", CognitiveStatics.ApplicationKey); | |||
#if UNITY_6000_0_OR_NEWER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version define UNITY_6000_0_OR_NEWER does not match Unity's actual scripting define symbols, so this branch may never trigger. Consider using a supported version define (e.g., UNITY_2023_2_OR_NEWER) or a custom define for the new API availability.
#if UNITY_6000_0_OR_NEWER | |
#if UNITY_2023_2_OR_NEWER |
Copilot uses AI. Check for mistakes.
Description
The following update was made for Unity 6000 and newer versions:
Linear Issue ID(s) (If applicable): SDK-26
Type of change
Checklist