c# - if (!localplayer) not doing anything -


i'm making multiplayer dodgeball game , every time start host , client, 1 of players can move.enter image description here

i want players move independently. here (updated) code:

using system.collections; using system.collections.generic; using unityengine; using unityengine.networking; public class script4network : networkbehaviour {  // use initialization void start() { if (!islocalplayer)     {          gameobject.getcomponent<firstpersoncontroller>().enabled = false;         gameobject.getcomponent<throwing>().enabled = false;         gameobject.getcomponent<headbob>().enabled = false;         // gameobject.getcomponent<camera>().enabled = false;     } }  void update() {  } } 

this isn't answer because i've been out of unity long, know:

void update() {     if (!islocalplayer)     {         return;     } } 

does nothing @ all. it's same thing as:

void update() {     if (!islocalplayer)     {         return;     }     return; } 

because every function returns @ end. if we're not local, return immediately. otherwise, return immediately. need way disable input controls -- maybe in start() find input controls component , disable if !islocalplayer.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -