- Home /
 
 
               Question by 
               SethiXzon · Jun 24, 2012 at 03:27 AM · 
                networkinginstantiatemultiplayerissue  
              
 
              Unity Network Instantiate Issue
I have a basic multiplayer system set up. When my friend joins; we can freely move our characters. However; when I add the script below; we can not move said characters; when we place prefabs; it spawns on both of our characters' positions (duplicated), but as soon as said person leaves; I can move and place items again.
If it is of any assistance; every block that is instantiated is aligned to a grid via the Start() function.
The instancing script:
 function Update () {
 var rotat : Transform;
 
 if (Input.GetMouseButtonDown (0))
 {
 if (BlockProperties.isReadyToDelete == false) {
     if (BlockProperties.isOverBlock == false) {
      var CubePrefab : GameObject = Resources.Load("CubePrefab");
      var ray : Ray = camera.ScreenPointToRay (Input.mousePosition);
      var hit : RaycastHit;
      var noDeg : Quaternion;
 if (Physics.Raycast (ray, hit)) {
      Network.Instantiate (CubePrefab, Vector3(hit.point.x, hit.point.y, hit.point.z), noDeg, 0);
      }
      }
     }
 else {
 // The delete function is actually recycled from an older version of this script and thus is not implemented in the game.
 print("Can not delete brick!");
 }
    }
 }
 
              
               Comment
              
 
               
              Your answer