I am getting these warning messages when the Host & Client Spawn into the scene
Model (1) is disabled! Netcode for GameObjects does not support disabled NetworkBehaviours! The OwnerNetworkAnimator component was skipped during ownership assignment!
Model (1) is disabled! Netcode for GameObjects does not support spawning disabled NetworkBehaviours! The OwnerNetworkAnimator component was skipped during spawn!
If you have server-authoritative movement (the default) then the owner might be the server for all player objects. I’m not sure and can’t confirm if that holds true for player objects. Try logging NetworkBehaviour.IsOwnedByServer to see if server owns those.
If you need movement client-authoritative you can get that script from Boss Room example or take mine, it lets you change authoritah at runtime. Sorry about the name, big South Park fan.
Also, you could simply choose to Destroy() or enabled=false the character controller script in OnNetworkSpawn if it isn’t the owner object and skip the check in Update. That way you’d also see in the Inspector who got the controller and who doesn’t and you don’t have to add even more IsOwner checks anywhere (ie OnDisable, LateUpdate, and so on).
So I have the soloution working in another smaller projects using
public override void OnNetworkSpawn()
{
if (!IsLocalPlayer) enabled = false;
}
This is turning off the player controller script for the player that is not local.
This works fine in the prototype project but I cant get it to work the same way in my main project
The script is disabling as expected but the 2 players are still being controlled on both the Host & Client from both inputs.
In the editor everything is showing as expected for both players (IsHost / IsLocalPlayer / Script disabled)
Could this be an issue with the new input system? Do I need to have a control scheme for Player1 & Player2?
New input system is fine, and you don’t need control scheme for player1 & player2. That wouldn’t make any sense unless you’re trying to do split-screen co-op game.
So it was because I was using 2 instances on the same machine - the input was being read by both. I was able to get the outcome when I played a host & client across 2 different machines using gamepads. Each gamepad controlled their own player. Problem solved!