- Home /
 
instantiate spawning meany objects in multiplayer
hey iam using appwarp for multiplayer and i have a player asset which i want to instantiate on the network.iam using the sample script that came with it and it just creates a primitive capsule.but when i change it to resources. load,it instantiates loads of copies of the player continuously even though the function is supposed to work only once.please help
original code snippet :
 void Start () {
         
         addPlayer();
     }
     
     public float interval = 0.1f;
     float timer = 0;
 
     
     public static GameObject obj;
     
     public static void addPlayer()
     {
         obj = GameObject.CreatePrimitive(PrimitiveType.Capsule);
         obj.transform.position = new Vector3(732f,1.5f,500f);
     }
 
               modified code using Resources.load: void Start () {
         addPlayer();
     }
     
     public float interval = 0.1f;
     float timer = 0;
 
     
     public static GameObject obj;
     
     public static void addPlayer()
     {
         obj = Instantiate(Resources.Load("Player", typeof(GameObject))) as GameObject;
         obj.transform.position = new Vector3(732f,1.5f,500f);
     }
         
 
               Please help!
Your answer
 
             Follow this Question
Related Questions
Instantiated object not showing in scene or hierarchy 2 Answers
Make object show on client side in multiplayer 0 Answers
How do i check which object was instantiated last? 1 Answer
Unity 5.2 Unet, extreme Lags after updating from 5.1 1 Answer
Is there anyway to delete clones that are local variables? 1 Answer