Question by 
               LABoy · Oct 25, 2015 at 05:25 AM · 
                unity 5networkinginstantiatenetwork  
              
 
              Spawn Objects in a Server UNet
So I am working on a multiplayer TPS. Right now I am working on the shooting aspect. Everything is working, the bullets are spawning and everything, but on other clients they don't show up. I have a network identity on the bullet prefab with nothing checked. I also have the bullet prefab in the registered spawnable prefabs list. The problem could be in the shooting script, but I don't know where it would go wrong. Here is the script, using UnityEngine; using UnityEngine.Networking;
public class ShootingScript : NetworkBehaviour {
 public Transform bulletSpawn;
 public Transform raycastStart;
 public Transform aimingPoint;
 public Transform endPos;
 public Rigidbody bullet;
 public float force;
 public float destroySpeed;
 private bool foundHit;
 
 RaycastHit hit;
 public float range;
 void Update ()
 {
     Debug.DrawLine(raycastStart.position, aimingPoint.position);
     Raycasting ();
     EndRaycast ();
     bulletSpawn.LookAt(aimingPoint);
     if(Input.GetButtonDown("Fire1"))
     {
         Shoot ();
     }
 }
 void Raycasting()
 {
     if(Physics.Raycast(raycastStart.position, raycastStart.TransformDirection(Vector3.forward), out hit, range))
     {
         foundHit = true;
         if(foundHit)
         {
             aimingPoint.position = hit.point;
         } 
     } else {
         foundHit = false;
     }
     if(!foundHit)
     {
         aimingPoint.position = endPos.position;
     }
 }
 void Shoot ()
 {
     Rigidbody clone = Instantiate(bullet, bulletSpawn.position, bulletSpawn.rotation) as Rigidbody;
     clone.velocity = bulletSpawn.TransformDirection(Vector3.forward) * force;
     Destroy(clone.gameObject, destroySpeed);
 }
 void EndRaycast ()
 {
     endPos.position = raycastStart.position + raycastStart.TransformDirection(Vector3.forward).normalized * range;
 }
} Now I don't know if I need the NetworkServer.Spawn, but I tried it anyway. The problem with it is the bullet clone is a Rigidbody and not a GameObject. Thanks
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                