I’m trying to move a player on a client and it only moves on the host. I did the essentials, I added a NetworkManager, in the field player prefab I added my prefab player, the prefab has its Network Object and its NetworkTransform, and my code is the following:
Hi.
Did you add “network transform” component to player object?
Edit: (I saw that you said added)
I really highly recommend you video of CodeMonkey’s Tutorial.
I would like to make a suggestion about your code.
“Vector2 input = _inputController.MoveInput();” Do not put the line at the top of update.
Put these inside of if/else statement.
For example, if you have 5 players on the stage.
For the other 4 players, the Vector2 input = _inputController.MoveInput();" line would be run unnecessarily.
I guess one solution could have been to disable the PlayerInput component on the player prefab and enabling it in the OnNetworkSpawn override if you’re the owner:
public override void OnNetworkSpawn()
{
if (!IsOwner) return;
GetComponent<PlayerInput>().enabled = true;
}
Was that your solution?
FYI: To put code in your post you have to click on the button Insert Code, it will open a popup where you can select the language and paste your code, here is a screenshot: