What happened to NetworkStart in NetworkBehaviour?

Hello everyone,
This seems like a very dumb question, but at the Moment I am learning to use Netcode for Gameobjects (i.e. NetworkBehaviour) for a multiplayer setup. As the title says, i am stuck with the NetworkStart() Methode. The documentation https://docs-multiplayer.unity3d.com/docs/0.1.0/basics/networkbehavior tells that this methode exists (and is usable just as the Start() Methode in MonoBehaviour?), but it seems not to trigger. Can anyone please help me?

  • How do i use it?
  • When is it called?

Looks like OnNetworkSpawn replaced NetworkStart, according to this page https://docs-multiplayer.unity3d.com/docs/migration/upgrade-guide.

Check you’re looking at v1.0.0 of the documentation, although it doesn’t help in this case as the latest version of the page you looked at still mentions NetworkStart.

It’s OnNetworkSpawn now. It gets called whenever a NetworkObject gets spawned.
On the server: When you call Spawn(); on a new NetworkObject to spawn it.
On the clients: When the NetworkObject gets called through a spawn call of the server.

OnNetworkSpawn always gets called after Awake but is not guaranteed to be called before/after Start.

One difference between Start on OnNetworkSpawn is that you have to use the ‘override’ keyword like this:

public override void OnNetworkSpawn()
{
     .........
}
6 Likes