Here is my situation (sorry for the bad english):
I’m creating a simple Multiplayer Pokemon like game (3D). The player is a Third Person Pokemon trainer with his own camera, up to here all right.
The thing is that I want to spawn, when the player press a button, a pokemon (NPC) that follows the character which has spawned it.
I don’t know how to spawn that creature in client/server and I don’t know how to make the Pokemon only follows the player who has spawned it.
This is a part of my Network Behaviour where I’m trying to spawn it, but doens’t work well.
public GameObject followerPrefab;
void Update () {
if (!isLocalPlayer)
{
return;
}
if (Input.GetKeyDown(KeyCode.F)){
GameObject pet = Instantiate (followerPrefab, transform.position+(transform.forward*2), transform.rotation);
NetworkServer.Spawn (pet);
}
}
Any help will be appreciated.
Thanks!