-
Notifications
You must be signed in to change notification settings - Fork 450
refactor: Remove SIPTransport and replace it with UnityTransport #1870
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
Changes from all commits
744ea2b
be93240
0e27cb9
87d9615
df94893
72ee0b3
8981be6
c59eaf6
388d3b0
7609c35
5cd33f3
cdc68fd
a9aaf6d
87f8154
cd8c589
3d3421f
9d03654
74e75b2
ea87ed3
0325622
2503736
8f2ac41
e0f7fa7
4a23b77
2d816c1
9c80c35
22afc78
dcca79c
d850635
1549c2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,15 @@ public static void DeregisterNetworkObject(ulong localClientId, ulong networkObj | |
protected const uint k_DefaultTickRate = 30; | ||
protected abstract int NumberOfClients { get; } | ||
|
||
/// <summary> | ||
/// Set this to false to create the clients first. | ||
/// Note: If you are using scene placed NetworkObjects or doing any form of scene testing and | ||
/// get prefab hash id "soft synchronization" errors, then set this to false and run your test | ||
/// again. This is a work-around until we can resolve some issues with NetworkManagerOwner and | ||
/// NetworkManager.Singleton. | ||
/// </summary> | ||
Comment on lines
+82
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you mind elaborating a little more? what's going on here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its a little complicated, but it has to do with our integration tests running in the same thread, how we populate newly loaded (not yet "spawned") in-scene placed NetworkObjects, and NetworkObject.NetworkManager referencing NetworkManager.Singleton if NetworkObject.NetworkManagerOwner is null.
So, under some conditions you might want NetworkManager.Singleton to be the server and under other conditions you might want it to be a client. If you are loading a scene with in-scene placed NetworkObjects, then you will want the NetworkManager.Singleton to be the first client instantiated in order to properly synchronize/find the in-scene placed NetworkObjects (which are loaded by the server and not loaded by the client since they share the same scene space). If you want more details feel free to DM me in slack... really we need to handle in-scene placed NetworkObjects better... like that "pre-rfc" document outlines. |
||
protected bool m_CreateServerFirst = true; | ||
|
||
public enum NetworkManagerInstatiationMode | ||
{ | ||
PerTest, // This will create and destroy new NetworkManagers for each test within a child derived class | ||
|
@@ -108,8 +117,6 @@ public enum HostOrServer | |
protected bool m_UseHost = true; | ||
protected int m_TargetFrameRate = 60; | ||
|
||
protected NetcodeIntegrationTestHelpers.InstanceTransport m_NetworkTransport = NetcodeIntegrationTestHelpers.InstanceTransport.SIP; | ||
|
||
private NetworkManagerInstatiationMode m_NetworkManagerInstatiationMode; | ||
|
||
private bool m_EnableVerboseDebug; | ||
|
@@ -252,7 +259,7 @@ protected void CreateServerAndClients(int numberOfClients) | |
CreatePlayerPrefab(); | ||
|
||
// Create multiple NetworkManager instances | ||
if (!NetcodeIntegrationTestHelpers.Create(numberOfClients, out NetworkManager server, out NetworkManager[] clients, m_TargetFrameRate, m_NetworkTransport)) | ||
if (!NetcodeIntegrationTestHelpers.Create(numberOfClients, out NetworkManager server, out NetworkManager[] clients, m_TargetFrameRate, m_CreateServerFirst)) | ||
{ | ||
Debug.LogError("Failed to create instances"); | ||
Assert.Fail("Failed to create instances"); | ||
|
@@ -558,6 +565,7 @@ protected void DestroySceneNetworkObjects() | |
} | ||
if (CanDestroyNetworkObject(networkObject)) | ||
{ | ||
networkObject.NetworkManagerOwner = m_ServerNetworkManager; | ||
// Destroy the GameObject that holds the NetworkObject component | ||
Object.DestroyImmediate(networkObject.gameObject); | ||
} | ||
|
@@ -668,6 +676,7 @@ protected GameObject CreateNetworkObjectPrefab(string baseName) | |
var gameObject = new GameObject(); | ||
gameObject.name = baseName; | ||
var networkObject = gameObject.AddComponent<NetworkObject>(); | ||
networkObject.NetworkManagerOwner = m_ServerNetworkManager; | ||
NetcodeIntegrationTestHelpers.MakeNetworkObjectTestPrefab(networkObject); | ||
var networkPrefab = new NetworkPrefab() { Prefab = gameObject }; | ||
m_ServerNetworkManager.NetworkConfig.NetworkPrefabs.Add(networkPrefab); | ||
|
This file was deleted.
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.
@ShadauxCat ?