x


OnNetworkInstantiate does not call

Dear All,

What can be the reason of OnNetworkInstantiate not to call? I am instantiating on network gameobjects via Network.Instantiate, gameobjects appear but OnNetworkInstantiate method does not call. So its very difficult me to control created objects: to rename them accordingly before game begins. Please, help.

more ▼

asked May 11 '12 at 06:55 AM

geronika2004 gravatar image

geronika2004
22 1 6 9

is the OnNetworkInstantiate function on the same object you have instantiated? otherwise it wont be called!

May 11 '12 at 07:06 AM flamy

I had everything in one cs file. I moved OnNetworkInstantiate to loaded gameobject and its called now.

Thank you.

May 11 '12 at 11:56 AM geronika2004

I have got one .CS file:

void createplayers()
{
   if (Network.isServer)
   {
      Network.Instantiate(Resources.Load("Prefabs/pl"), new Vector3(0,0,0), Quaternion.identity, 0);
   }
}
void OnNetworkInstantiate(NetworkMessageInfo info) 
{
   Debug.Log("created");       
}
May 11 '12 at 11:57 AM geronika2004

'OnNetworkInstantiate' gets called on the object being instantiated.

May 11 '12 at 11:58 AM syclamoth
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2

asked: May 11 '12 at 06:55 AM

Seen: 361 times

Last Updated: May 11 '12 at 11:58 AM