Skip to content

Commit c6315ce

Browse files
fix & update
Fixing test project not being able to load without an AnalyticsTests compilation error. Making ObjectNameIdentifier just use the new way we handle ChildNetworkBehaviours (i.e. it is a table now). Marking NetworkObject.ChildNetworkBehaviours comment above as having finished the migration to a table. Noting we should find a better place/way to initialize this stuff.
1 parent 211a50f commit c6315ce

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2816,11 +2816,13 @@ private NetworkPrefab GetPrefab(NetworkManager networkManager)
28162816
/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28172817
/// Convert ChildNetworkBehaviours to a
28182818
/// table so removing won't impact things.
2819+
/// (Done)
2820+
///
2821+
/// Find a place to do this initialization
2822+
/// somewhere else so we don't have a
2823+
/// megalithic getter.
28192824
/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28202825
/// </summary>
2821-
2822-
2823-
28242826
internal Dictionary<ushort, NetworkBehaviour> ChildNetworkBehaviours
28252827
{
28262828
get

com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/Components/ObjectNameIdentifier.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,10 @@ public override void OnDestroy()
108108
DeRegisterNetworkObject();
109109
// This is required otherwise it will try to continue to update the NetworkBehaviour even if
110110
// it has been destroyed (most likely integration test specific)
111-
#if UNIFIED_NETCODE
112111
if (m_NetworkObject.ChildNetworkBehaviours != null && m_NetworkObject.ChildNetworkBehaviours.ContainsKey(NetworkBehaviourId))
113112
{
114113
NetworkObject.ChildNetworkBehaviours.Remove(NetworkBehaviourId);
115114
}
116-
#else
117-
if (m_NetworkObject.ChildNetworkBehaviours != null && m_NetworkObject.ChildNetworkBehaviours.Contains(this))
118-
{
119-
NetworkObject.ChildNetworkBehaviours.Remove(this);
120-
}
121-
#endif
122115
m_NetworkObject = null;
123116
}
124117
base.OnDestroy();

testproject/Assets/Tests/Runtime/AnalyticsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ internal class AnalyticsTests : NetcodeIntegrationTest
2222
protected override IEnumerator OnSetup()
2323
{
2424
NetcodeAnalytics.EnableIntegrationTestAnalytics = true;
25-
m_NetcodeAnalytics = Unity.Netcode.Editor.NetworkManagerHelper.Singleton.NetcodeAnalytics;
25+
m_NetcodeAnalytics = Unity.Netcode.GameObjects.Editor.NetworkManagerHelper.Singleton.NetcodeAnalytics;
2626
yield return base.OnSetup();
2727
}
2828

testproject/Assets/Tests/Runtime/TestProject.Runtime.Tests.asmdef

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"Unity.Mathematics",
1616
"UnityEngine.TestRunner",
1717
"UnityEditor.TestRunner",
18-
"Unity.Netcode.Runtime.Tests"
18+
"Unity.Netcode.Runtime.Tests",
19+
"Unity.Netcode.GameObjects.Editor"
1920
],
2021
"includePlatforms": [],
2122
"excludePlatforms": [],

0 commit comments

Comments
 (0)