- Home /
Network Homing Missile
Hi all, Ive been porting a singleplayer project to multiplayer and having some issues with my homing missile. Essentially, the player selects a target gameobject and spawns a "missile" prefab with a simple guidance script (called abilityConstructor) on it controlling its movement. I then set the target parameter in this component and Spawn the prefab in the network. So far ive been attempting this:
[Command]
void CmdAttack(GameObject target){
GameObject newObject = Instantiate (missile, transform.position, transform.rotation);
newObject.GetComponent<AbilityConstructor> ().target = target;
NetworkServer.Spawn (newObject);
RpcAttack (target);
//abilityManager.targetAbility (target);
}
[ClientRpc]
void RpcAttack(GameObject target){
// What to do here??
}
Ive settled on this approach based on the reading i've done online, however its not really working. On the hosts screen, everything works fine as expected, however on the clients screens the prefab is spawned and remains stationary, with the "target" unassigned (also confirmed by an error message).
what is the best way to approach this functionality, and is any of my code even worthwhile keeping? Many thanks
Your answer
Follow this Question
Related Questions
UNET save server (world) progress 1 Answer
Spawing Hololens Camera OR ARCamera at user defined spawn locations 0 Answers
UNET Buying/changing weapons ingame by players 0 Answers
How to spawn character on desired position using UNET/Customized Network Manager?? 0 Answers
Architecture for a network game- problems with events 0 Answers