Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

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