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 How to override NetworkManager

Discussion in 'Netcode for GameObjects' started by rbitard, Oct 10, 2022.

  1. rbitard

    rbitard

    Joined:
    Jan 11, 2022
    Posts:
    197
    Is there a min version for 2021.3 (I have 2021.3.8f1) ?
    I tried to override NetworkManager because I want to change a few things before spawning the player but I can't find the method explained in the documentation.

    I do :
    Code (CSharp):
    1.    
    2. public class CustomNetworkManager : NetworkManager {
    3.         public virtual void OnServerAddPlayer(NetworkConnection conn,short playerControllerId) {
    4.             print("TOTO");
    5.         }
    6.     }
    7.  
    But the function isn't invoked nor found.
    I took the code from here
    https://docs-multiplayer.unity3d.com/netcode/current/components/networkmanager
     
  2. rbitard

    rbitard

    Joined:
    Jan 11, 2022
    Posts:
    197
    I think I got the wrong documentation, the new documentation doesn't talk about this snippet of code, I'll look into it