- Home /
Network Game - all players respond to same input
HELP
plan to create game that has same mechanics as counter strike. I created a player that can move and shoot. Apparently, my non-host player's character is just same as the host player's. PLUS when I move my host player it also moves the non-host players, but it doesn't affect the shooting part. (when the host shoots, the non-host players doesn't) ALSO, the non-host players can't move..
I've already put "if(!networkView.isMine)" on the scripts that is attached on the player which are Shooting, movement and health scripts.
void Start () {
if(!networkView.isMine)
{
enabled=false;
}
forceToAdd = new Vector3( 0, 50f, 50f );
}
The players should spawn separately, so that each of the players can play their characters even the non-host ones. Please help
It sounds like you are using Network.Instantiate on the host side to spawn all of the players. Which ever "player" spawns the networkView will be the owner.
So in your case, the host is spawning all of the players so therefore networkView.is$$anonymous$$ine will always return true for the host and false for the clients.
Judging by your problem you're also not using a non authoritative sever model, meaning that each client performs it's own movement and then sends it to all the connected peers.
Since you are using a non authoritative model, a solution could be for you to create a player manager script. Send RPC calls via this script to each player, to spawn their own characters, with Network.Instantiate, hence making them own their respective networkViews.
Hope this helps!
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
How should I approach multiplayer? 1 Answer
Unity relay server without matchmaking 0 Answers
Network command is running on client? 1 Answer
Is Start() always after OnStaretLocalPlayer() and isLocalPlayer 0 Answers