- Home /
OnNetworkInstantiate is never called
Hey !
I'm doing a simple multiplayer client-server game, but I've run into a issue where OnNetworkInstantiate is never called. Here's my code below for that method, incase I wrote something wrong with it.
void OnNetworkInstantiate(NetworkMessageInfo info)
{
Debug.Log("New object instantiated by " + info.sender);
if(networkView.isMine)
{ //if I am the owner of this prefab
Camera.main.transform.GetComponent<SmoothFollow2D>().target = spawnedPlayer.transform;
}
}
Thanks for any kind of help ! :)
Answer by Bunny83 · Jun 20, 2014 at 11:26 PM
The information you provided is a bit thin. Are you sure you use Network.Instantiate to create that object and that you do this after you have connected successfully? Also make sure that script is attached to the prefab you're creating
Your answer
Follow this Question
Related Questions
Network, Builds wont move 1 Answer
Network.Instantiate and NetworkServer.Spawn not working 2 Answers
Getting this error when using Network.Instantiate 0 Answers
Weird network spawning bug. 1 Answer
SetLevelPrefix not working as intended? 0 Answers