-
Notifications
You must be signed in to change notification settings - Fork 450
refactor: FindObject(s)OfType now filters NetworkManagers #763
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
Conversation
… can now be overriden BREAKING CHANGE: Static lifecycle properties in NetworkBehaviour are no longer static
PR is targeting |
Yeah |
for (int i = 0; i < networkObjects.Length; i++) | ||
{ | ||
if (networkObjects[i].IsSceneObject == null) | ||
if (networkObjects[i].NetworkManager == m_NetworkManager) |
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 was looking at this and wondering how this works in practice if you have 2 NM's. I get how you override the NM for a NO. How about for a scene? Or are we saying that just one NM will ever have the scene-defined objects? Then I wonder if the contrary of this is true, is it an error? That is you have a NO that is a scene object that belongs to the NM that is not the one that handles scene objects. If that's true (I know this is a long walk...) then seems like we should throw an exception here.
@@ -499,17 +499,20 @@ internal void DestroyNonSceneObjects() | |||
|
|||
for (int i = 0; i < networkObjects.Length; i++) | |||
{ | |||
if (networkObjects[i].IsSceneObject != null && networkObjects[i].IsSceneObject.Value == false) | |||
if (networkObjects[i].NetworkManager == NetworkManager) |
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.
Same comment as above
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'd like to understand a bit more how multi-scene works with multi-NMs and scene objects.
Then depending on this, seems like a multi-scene test is order?
To answer those questions above. Right now you have the same override mechanism for NetworkObjects. By default they go and spawn themselves on the Singleton but if it's manually overriden it will go to that one. Nothing really going on. As for Multi-scene tests where we actually do scene switching. That is not yet covered by this PR and it's something not yet looked into. (As was outlined in the proposal). But I think I should be able to make it work fairly easily. It all really depends on how much I can hack the new GlobalObjectId system. The old PrefabHash system was easy to inject values into. |
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.
Looks good.
d77f930
to
84cf1c1
Compare
@@ -577,9 +586,12 @@ internal void ClientCollectSoftSyncSceneObjectSweep(NetworkObject[] networkObjec | |||
|
|||
for (int i = 0; i < networkObjects.Length; i++) | |||
{ | |||
if (networkObjects[i].IsSceneObject == null) | |||
if (networkObjects[i].NetworkManager == NetworkManager) |
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.
Almost all places use the owner NetworkManager by default.
This is the only place we use FindObjectsOfType and thus aren't filtered yet properly.
No description provided.