Conversation
… MultiInstanceHelpers.MakeNetworkObjectTestPrefab()
0xFA11
commented
Aug 25, 2021
Comment on lines
+229
to
+234
| // Fallback to auto-increment if generation fails | ||
| if (networkObject.GlobalObjectIdHash == default) | ||
| { | ||
| networkObject.GlobalObjectIdHash = ++s_AutoIncrementGlobalObjectIdHashCounter; | ||
| } | ||
|
|
Contributor
Author
There was a problem hiding this comment.
this is the main addition
0xFA11
commented
Aug 25, 2021
| /// <param name="networkObject">The networkObject to be treated as Prefab</param> | ||
| /// <param name="globalObjectIdHash">The GlobalObjectId to force</param> | ||
| public static void MakeNetworkedObjectTestPrefab(NetworkObject networkObject, uint globalObjectIdHash = default) | ||
| public static void MakeNetworkObjectTestPrefab(NetworkObject networkObject, uint globalObjectIdHash = default) |
Contributor
Author
There was a problem hiding this comment.
also using this as a chance to correct the method name here too
0xFA11
commented
Aug 25, 2021
Comment on lines
+81
to
+85
| server.NetworkConfig.NetworkPrefabs.Add(new NetworkPrefab { Prefab = m_PlayerPrefabOverride }); | ||
| foreach (var client in clients) | ||
| { | ||
| client.NetworkConfig.NetworkPrefabs.Add(new NetworkPrefab { Prefab = m_PlayerPrefabOverride }); | ||
| } |
Contributor
Author
There was a problem hiding this comment.
also this PR exposed this issue here too (it should've registered prefabs with networkmanagers but never did).
so, we're killing 2 issues with 1 fix here :)
f898733 to
24cc69a
Compare
0xFA11
commented
Aug 26, 2021
Comment on lines
59
to
+60
| Assert.AreEqual(Client.LocalClientId, objectSpawned.Connection.Id); | ||
| Assert.AreEqual(NewNetworkObjectName, objectSpawned.NetworkId.Name); | ||
| Assert.AreEqual($"{k_NewNetworkObjectName}(Clone)", objectSpawned.NetworkId.Name); |
Contributor
Author
There was a problem hiding this comment.
@becksebenius-unity FYI for changes in this file. tests were quite tricky — I think they're more reliable now.
Contributor
There was a problem hiding this comment.
Awesome! I think @josiemessa will be interested too
mollstam
pushed a commit
to Keepsake-Games/com.unity.netcode.gameobjects
that referenced
this pull request
Feb 13, 2023
…in `MultiInstanceHelpers.MakeNetworkObjectTestPrefab()` + fix flaky tests exposed by this fix (Unity-Technologies#1094) * refactor: assign auto-incremented GlobalObjectIdHash as a fallback in MultiInstanceHelpers.MakeNetworkObjectTestPrefab() * fix MultiClientConnectionApproval.ConnectionApproval() test * refactor Removing DefaultPayerGlobalObjectIdHashValue with new GlobalObjectIdHash goodness. * fix NetworkObjectMetricsTests * remove `DefaultPayerGlobalObjectIdHashValue` from OwnershipChangeMetricsTests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
a quick follow-up refactor after PR #1092