My I have a command that runs on a player object that spawns a bullet prefab on the server and sets a bunch of its variables to different things but it isn’t being spawned when I call NetworkServer.Spawn(bullet);
I have checked and it is being registered, in both the inspector and I tried in code to check to see if I registered it incorrectly but that isn’t the issue. I know that it’s not being called because I can pause the game, go to the Network Identity and click spawn then the bullet works as intended.
Here is my code:
`[Command]
void CmdspawnBullet(Vector3 parent, float XPosOff,float ZPosOff, float XNegOff, float ZNegOff, Vector3 scaleFactor, float XSpeed, float YSpeed, float ZSpeed, bool Mover, Vector3 bulletTarget)
{
//set the transform of the bullet then instantiate and spawn
GameObject bullet = (GameObject)Resources.Load ("bullet");
print ("Spawn " + bullet);
//bullet.SetActive (true);
Vector3 bulletPos = new Vector3(parent.x + XPosOff + XNegOff, parent.y, parent.z + ZNegOff + ZPosOff);
ClientScene.RegisterPrefab(bullet);
GameObject.Instantiate(bullet, bulletPos, Quaternion.identity);
NetworkServer.Spawn (bullet);
bullet.transform.LookAt(bulletTarget);
bullet.transform.position = bulletPos;
bullet.transform.localScale = scaleFactor;
bullet.GetComponent<BulletScript>().speedZ = ZSpeed;
bullet.GetComponent<BulletScript>().speedY = YSpeed;
bullet.GetComponent<BulletScript>().speedX = XSpeed;
bullet.GetComponent<BulletScript>().doWeMove = Mover;
}`