Hi,
I am making a turn based game where each player shoots a projectile. I have a camera script for following the projectile.
I have this script for shooting the projectile:
[Command]
void CmdShoot(float power,float angle)
{
GameObject projectile = Shoot(power, angle);
NetworkServer.Spawn(projectile);
}
This runs on the server and correctly spawns the projectile on all clients. Question is, how do I run the follow script on the client?
[ClientRpc]
public void RpcFocusOn(NetworkInstanceId id)
{
GameObject localObject = ClientScene.FindLocalObject(id);
target = localObject.transform;
this.enabled = true;
}
I tried various ways to get the network identifier of the spawned projectile to pass to the rpc, but it always gives an NPE exception.
Am I going about this the wrong way?
thanks