Skip to content

Commit f2f6580

Browse files
update
Some fixes that should accompany the N4E POC branch.
1 parent da1beaf commit f2f6580

File tree

4 files changed

+6
-43
lines changed

4 files changed

+6
-43
lines changed

com.unity.netcode.gameobjects/Runtime/Components/Helpers/NetworkObjectBridge.cs

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,53 +15,13 @@ namespace Unity.Netcode
1515
public partial class NetworkObjectBridge : GhostBehaviour
1616
{
1717
public Action<ulong> NetworkObjectIdChanged;
18-
18+
1919
internal GhostField<ulong> NetworkObjectId = new GhostField<ulong>();
2020

2121
public void SetNetworkObjectId(ulong value)
2222
{
2323
NetworkObjectId.Value = value;
2424
}
25-
public override void Awake()
26-
{
27-
if (UnifiedBootStrap.Instance != null)
28-
{
29-
Initialize();
30-
}
31-
else
32-
{
33-
UnifiedBootStrap.OnInitialized += Initialize;
34-
}
35-
}
36-
37-
private void Initialize()
38-
{
39-
UnifiedBootStrap.OnInitialized -= Initialize;
40-
if (gameObject != null)
41-
{
42-
base.Awake();
43-
NetworkObjectId.ValueChanged += OnNetworkObjectIdChanged;
44-
}
45-
}
46-
47-
private void OnNetworkObjectIdChanged(ulong value)
48-
{
49-
NetworkObjectIdChanged?.Invoke(value);
50-
}
51-
52-
internal void OnDespawn(bool shouldDestroy)
53-
{
54-
if (shouldDestroy)
55-
{
56-
UnifiedBootStrap.OnInitialized -= Initialize;
57-
}
58-
}
59-
60-
public override void OnDestroy()
61-
{
62-
UnifiedBootStrap.OnInitialized -= Initialize;
63-
base.OnDestroy();
64-
}
6525
}
6626

6727
/// <summary>

com.unity.netcode.gameobjects/Runtime/Components/Helpers/UnifiedUpdateConnections.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected override void OnUpdate()
5858
// client has signaled that it has synchronized (or has been sent the synchronization data) we finalize the in-game connection state (or something along those lines).
5959
if (!m_NewConnections.ContainsKey(networkId.Value))
6060
{
61-
var delayTime = isServer ? 0.2f : 0.1f;
61+
var delayTime = 0.0f;// isServer ? 0.2f : 0.1f;
6262
var newConnection = new NetcodeConnection { World = World, Entity = entity, NetworkId = networkId.Value, ConnectedTime = UnityEngine.Time.realtimeSinceStartup + delayTime};
6363
m_NewConnections.Add(networkId.Value, newConnection);
6464
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,10 @@ private bool CanStart(StartType type)
13101310
#if UNIFIED_NETCODE
13111311
private System.Collections.IEnumerator WaitForHybridPrefabRegistration(StartType startType)
13121312
{
1313+
if (NetCode.Netcode.IsActive)
1314+
{
1315+
NetworkLog.LogInfo($"[{nameof(WaitForHybridPrefabRegistration)}] Netcode is not active but has an instance at this point.");
1316+
}
13131317
DefaultWorldInitialization.Initialize("Default World", false);
13141318
var waitTime = new WaitForSeconds(0.016f);
13151319
// This should not be needed at this point, but here in the event something changes.

com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,6 @@ internal void OnDespawnObject(NetworkObject networkObject, bool destroyGameObjec
18641864
// Let unified netcode handle destroying
18651865
if (destroyGameObject && networkObject.HasGhost && !NetworkManager.IsServer)
18661866
{
1867-
networkObject.NetworkObjectBridge.OnDespawn(destroyGameObject);
18681867
// exit early
18691868
return;
18701869
}

0 commit comments

Comments
 (0)