Skip to content

fix: MLAPI spawned objects now sets NetworkManager override #767

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

TwoTenPvP
Copy link
Contributor

No description provided.

@@ -225,6 +225,8 @@ internal NetworkObject CreateLocalNetworkObject(bool softCreate, uint prefabHash
// Otherwise, instantiate an instance of the NetworkPrefab linked to the prefabHash
var networkObject = ((position == null && rotation == null) ? UnityEngine.Object.Instantiate(networkPrefabReference) : UnityEngine.Object.Instantiate(networkPrefabReference, position.GetValueOrDefault(Vector3.zero), rotation.GetValueOrDefault(Quaternion.identity))).GetComponent<NetworkObject>();

networkObject.NetworkManagerTestOverride = NetworkManager;
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably worth a comment saying something like "by default all network objects are spawned with this singleton, central NM which can be overridden for testing"

Copy link
Contributor

Choose a reason for hiding this comment

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

as per my comments in #762, I'm still not 100% onboard with this approach yet.

Copy link
Contributor

@0xFA11 0xFA11 left a comment

Choose a reason for hiding this comment

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

as I was commenting in #762, let's align about our direction internally first.

Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity left a comment

Choose a reason for hiding this comment

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

Other than the existing comments, the rest looks good to me!

Copy link
Contributor

@0xFA11 0xFA11 left a comment

Choose a reason for hiding this comment

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

since now we're aligned, I'm onboard with our short-term solution.

@TwoTenPvP TwoTenPvP merged commit 9da7f65 into singleton-removal-network-transform Apr 29, 2021
@TwoTenPvP TwoTenPvP deleted the singleton-removal-spawn-manager-ownership branch April 29, 2021 15:32
@TwoTenPvP TwoTenPvP restored the singleton-removal-spawn-manager-ownership branch April 29, 2021 15:34
@0xFA11 0xFA11 deleted the singleton-removal-spawn-manager-ownership branch April 29, 2021 16:04
TwoTenPvP added a commit that referenced this pull request Apr 29, 2021
* fix: MLAPI spawned objects now sets NetworkManager override (#767)
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.

4 participants