I’m trying convert the survival shooter to multiplayer version by UNet introduced in Unity5.x, the new network system. But I encountered a problem when spawning the GunBarrelEnd effect(shoot effect) to the client. The code is something like this:
[Command]
void CmdShoot ()
{
Transform gbe = transform.Find (“GunBarrelEnd”);
timer = 0;
bullet = (GameObject)Instantiate (bulletPrefab,gbe.position,Quaternion.Euler(0,0,0));
bullet.GetComponent ().Shoot (gbe);
Destroy (bullet, 1.0f);
NetworkServer.Spawn (bullet);
}
the bulletPrefab is a prefab extracted from the player child object (GunBarrelEnd) ,added a networkidentity component and a networktransform, also is registered in the networkmananger’s spawnable prefab.
But when I call the CmdShoot, the shooting effect( facelight and bullet line) only show in the host, never take effect in the client.
Any on can help? Thx.