How do you sync Network Manager and Network Objects?

Essentially, on my Awake() function in the Network Object I have:

Debug.Log($"Is server {NetworkManager.IsServer}"); //true
Debug.Log($"Is host {NetworkManager.IsHost}"); //true
Debug.Log($"Is client {NetworkManager.IsClient}"); //true

Debug.Log($"Is server {IsServer}"); //false
Debug.Log($"Is host {IsHost}"); //false
Debug.Log($"Is client {IsClient}"); //false

So even though the Network Manager says that I'm the host, I can't edit any of the Network Lists or Network Variables in the Network Object because the Network Object thinks that I am not the host.

How would one fix this?

Awake is likely too early, try using OnNetworkSpawn.

Thanks, it now works!

1 Like