-
Notifications
You must be signed in to change notification settings - Fork 462
chore: update usage of deprecated FindObjectsByType<T>(FindObjectsSortMode) and enum FindObjectSortMode #3857
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
chore: update usage of deprecated FindObjectsByType<T>(FindObjectsSortMode) and enum FindObjectSortMode #3857
Conversation
Funneling all find object related calls into a single static method in order to simplify the current, and any future, updates/changes to FindObjectsByType.
Making FindObjects internal.
Adjusted to explicit handling of the update within test project script to avoid having to make FindObjects public.
Adding [MethodImpl(MethodImplOptions.AggressiveInlining)] attribute to the T[] FindObjectsByType<T>() method.
Removing unused using directives. Removing CR.
@EmandM
EmandM
left a comment
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.
I love love love this cleanup! :godmode:
com.unity.netcode.gameobjects/Tests/Runtime/Prefabs/NetworkPrefabHandlerTests.cs
Outdated
Show resolved
Hide resolved
testproject/Assets/Tests/Manual/SceneTransitioningAdditive/NetworkManagerMonitor.cs
Outdated
Show resolved
Hide resolved
testproject/Assets/Tests/Manual/SceneTransitioningAdditive/NetworkManagerMonitor.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Emma <emma.mcmillan@unity3d.com>
Adding same condition define, NGO_FINDOBJECTS_NOSORTING, to the testproject.manualtests assembly define.
Added more precise Unity engine versions to asmdef files to assure earlier versions of 6000.4 and 6000.5 still use the previous API. Renamed FindObjects.FindObjectsByType to FindObjects.ByType Updated FindObject.ByType to be able to sort by identifier and include inactive objects.
Adding sort by identifier to two locations that require sorting by identifier.
Added missing whitespace
increasing the 6000.5 version from 5.0a6 to 5.0a7 as it appears trunk is currently 5.0a6 (which doesn't have the deprecation merged into it yet).
updating minimum for deprecated fix to 600050a8.
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.
I see you implemented this retro-compatibility fix to avoid compilation errors on alpha/beta versions that didn't have the deprecation change yet, but do we intend to support those versions in the long run?
The risk I foresee is that we fill our code with a bunch of defines for "almost-dead code", with an increased maintenance burden for us, and higher rissk to introduce bugs as we have to support multiple workflows.
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.
Making it work with earlier versions actually prevents users that have yet to upgrade their editor from breaking if they decide to upgrade to the current version of NGO (whichever version that will be once this PR is merged). Otherwise, it would be considered a breaking change for earlier 6000.4 & 6000.5 versions.
But yeah... that is a good point and one of the reasons why I migrated all of the changes into the single FindObjects.ByType<T> method... so there is one place that handles this which also reduces the number of times we have to use the conditional define.
Test project had two places that I added this to in order to prevent from having to make FindObjects public.
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.
We also do the work to remove the scripting defines once we no longer support that Unity version. So these defines won't live forever
@EmandM
EmandM
left a comment
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.
I love love love the latest name here! :godmode:
This "should" fix the Rust server issue... I think? (Tested local instance on 600050a7 and it passes everything)
adding change log entry
Uh oh!
There was an error while loading. Please reload this page.
WIP-TODO:
Purpose of this PR
Making adjustments to the changes in FindObjectsByType. Funneling all find object related calls into a single static method in order to simplify the current, and any future, updates/changes to FindObjectsByType.
Jira ticket
MTT-14339
Changelog
Documentation
Testing & QA (How your changes can be verified during release Playtest)
Functional Testing
Manual testing :
Manual testing doneUnityEngine.FindObjectsSortMode.UnityEngine.FindObjectsSortMode.UnityEngine.FindObjectsSortMode.UnityEngine.FindObjectsSortMode.Automated tests:
Covered by existing automated testsCovered by new automated testsDoes the change require QA team to:
Review automated tests?Execute manual tests?Provide feedback about the PR?If any boxes above are checked the QA team will be automatically added as a PR reviewer.
Backports
No back port required since this is specific to 6000.4 & 6000.5.