Hi everybody. I’m developing a simple multiplayer online game with Unity3d. I have a problem with player instantiate.
For each player I network instantiate an empty game object prefab and I instantiate the character prefab and make it child of empty game object prefab (I use this method because I have some problem with character pivot and orientation).
The problem is that players that are playing can see only the other empty object and not the other child object (the remote characters).
How can I solve my problem? This is my code:
var respawn_x=Random.Range(-3134.925,-3473.049); var respawn_z=Random.Range(645.9182,941.0953); var respawn_y = 206.66; var ObjectParent = Network.Instantiate(GameObjectVuoto, transform.position, transform.rotation,0); charController = ObjectParent.GetComponent(CharacterController); charController.radius = 15.04244; charController.height = 38.8195; pl = Network.Instantiate(characterPrefab, transform.position, transform.rotation,0); pl.transform.parent = ObjectParent.transform; ObjectParent.transform.position = Vector3(respawn_x,respawn_y,respawn_z); pl.transform.Rotate(Vector3(0,355.5273,0));
I’ve tried making a network.instantiate also for the character prefab (attaching a network view) but it doesn’t work.