Skip to content

fix: This fixes the issue with recent 2023 update where FindObjectsOfType was renamed to FindObjectsByType#2320

Merged
NoelStephensUnity merged 21 commits intodevelopfrom
fix/findobjectsoftype-to-findobjectsbytype
Nov 23, 2022
Merged

fix: This fixes the issue with recent 2023 update where FindObjectsOfType was renamed to FindObjectsByType#2320
NoelStephensUnity merged 21 commits intodevelopfrom
fix/findobjectsoftype-to-findobjectsbytype

Conversation

@NoelStephensUnity
Copy link
Copy Markdown
Member

This fixes the issue with recent 2023 update where FindObjectsOfType was renamed to FindObjectsByType

Adding the 2023.1.a21 FindObjectsByType fix for testproject.
Adding the 2023.1.a21 FindObjectsByType fix for testproject.multiprocesstests.
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review November 21, 2022 22:31
@NoelStephensUnity NoelStephensUnity requested review from a team and 0xFA11 as code owners November 21, 2022 22:31
Fixes the rest of the assemblies that had scripts that used FindObjectsOfType
Possible fix for what seems to be a timing related issue where not destroying the source prefab NetworkObject/GameObject it could cause an exception to occur.
This reverts commit 420768a.
Comment thread com.unity.netcode.gameobjects/Tests/Runtime/com.unity.netcode.runtimetests.asmdef Outdated
Removing the duplicate UNITY_INCLUDE_TESTS
Prevent final NetworkObject clean up from causing exceptions on 2023 builds.
This takes some additional scenarios into consideration.
Comment thread com.unity.netcode.gameobjects/Editor/NetworkManagerHelper.cs Outdated
This fixes the integration test issue on 2023.1.0a21.
getting that section of the code back to its original
Removing the extra destroyimmediate...
White space
Approaching the fix by using Jesse's suggested pragma 612 & 618 when UNITY_2023_1_OR_NEWER is defined.
Reverting the asmdef files back to their original state prior to this PR.
adding new line
remove one new line add another
Cleaning up the adjustments so that as little code and how it is formatted is impacted (as possible).
Comment thread com.unity.netcode.gameobjects/Editor/NetworkManagerHelper.cs
removing extra lines that were not there prior to this PR.
The new direction is to just simply use UNITY_2023_1_OR_NEWER.
Modifying a few of the FindObjectsSortMode for areas that looked like they might require their results ordered by InstanceID.
}

#if UNITY_2023_1_OR_NEWER
var networkObjects = UnityEngine.Object.FindObjectsByType<NetworkObject>(FindObjectsSortMode.InstanceID);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how there's sort by InstanceId on the API built-in.

@NoelStephensUnity NoelStephensUnity merged commit 8ee79ab into develop Nov 23, 2022
@NoelStephensUnity NoelStephensUnity deleted the fix/findobjectsoftype-to-findobjectsbytype branch November 23, 2022 17:40
NoelStephensUnity added a commit that referenced this pull request Nov 23, 2022
…Type was renamed to FindObjectsByType (#2320)

* update
Adding the 2023.1.a21 FindObjectsByType fix for NGO using the UNITY_2023_1_OR_NEWER define.
Modified a few of the FindObjectsSortMode for areas that looked like they might require their results ordered by InstanceID.
JesseOlmer pushed a commit that referenced this pull request Dec 1, 2022
…ch (#2325)

fix: This fixes the issue with recent 2023 update where FindObjectsOfType was renamed to FindObjectsByType (#2320)

* update
Adding the 2023.1.a21 FindObjectsByType fix for NGO using the UNITY_2023_1_OR_NEWER define.
Modified a few of the FindObjectsSortMode for areas that looked like they might require their results ordered by InstanceID.
jakobbbb pushed a commit to GooseGirlGames/com.unity.netcode.gameobjects that referenced this pull request Feb 22, 2023
…ch (Unity-Technologies#2325)

fix: This fixes the issue with recent 2023 update where FindObjectsOfType was renamed to FindObjectsByType (Unity-Technologies#2320)

* update
Adding the 2023.1.a21 FindObjectsByType fix for NGO using the UNITY_2023_1_OR_NEWER define.
Modified a few of the FindObjectsSortMode for areas that looked like they might require their results ordered by InstanceID.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants