Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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