Unity-Technologies / com.unity.multiplayer.docs

Open Source documentation for Unity Multiplayer, which includes Netcode for GameObjects, the Unity Transport Package, Multiplayer Tools and Educational references and Sample Games such as Boss Room.
https://docs-multiplayer.unity3d.com/
Other
656 stars 202 forks source link

HelloWorldManager.cs references HelloWorldPlayer #1319

Open JacobChrist opened 3 months ago

JacobChrist commented 3 months ago

Describe the bug: HelloWorldManager.cs references HelloWorldPlayer which has not yet been created in the tutorial on this page:

https://github.com/Unity-Technologies/com.unity.multiplayer.docs/blob/main/docs/tutorials/get-started-with-ngo.md

Simply commenting out the body of SubmitNewPosition() allows the script to work.

   static void SubmitNewPosition()
    {
        //if (GUILayout.Button(NetworkManager.Singleton.IsServer ? "Move" : "Request Position Change"))
        //{
        //    if (NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsClient)
        //    {
        //        foreach (ulong uid in NetworkManager.Singleton.ConnectedClientsIds)
        //            NetworkManager.Singleton.SpawnManager.GetPlayerNetworkObject(uid).GetComponent<HelloWorldPlayer>().Move();
        //    }
        //    else
        //    {
        //        var playerObject = NetworkManager.Singleton.SpawnManager.GetLocalPlayerObject();
        //        var player = playerObject.GetComponent<HelloWorldPlayer>();
        //        player.Move();
        //    }
        //}
    }
JacobChrist commented 3 months ago

Also a using HelloWorld; is needed since the HelloWorldPlayer is in a different namesapce (when you get to it in the tutorial).