Search Unity

Question Callback when Player is spawned

Discussion in 'Netcode for GameObjects' started by Pillow1337, Jan 8, 2022.

  1. Pillow1337

    Pillow1337

    Joined:
    Feb 14, 2021
    Posts:
    1
    Hello guys,

    at the moment I am trying to build a very minimal FPS based on Unity Netcode.
    Is there any callback I can hook into when the player prefab is spawned?

    I couldn't find anything like this in the docs or sourcecode.

    Thanks for your help
    Pillow1337
     
  2. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    191
    there is only NetworkManager.Singleton.OnClientConnectedCallback, not sure if the player is already spawned by that time, but you can also implement OnNetworkSpawn on your player object