Add New Game Object To Existing Photon View
Options
zaki
✭
Hello,
Is it possible to add a game object (as a child) to an existing Photon View game object?
Something like this:
MyPUNManager.cs
And the in playerAvatar attached a player script player.cs
player.cs
Want I want to do is, after Instanstiate player through PhotonNetwork function, i want to attached an existing game object to it and sync its position and rotation across the network.
Please advise, thanks.
Is it possible to add a game object (as a child) to an existing Photon View game object?
Something like this:
MyPUNManager.cs
var player = PhotonNetwork.Instantiate (playerAvatar.name, trans.position, trans.rotation, 0);
And the in playerAvatar attached a player script player.cs
player.cs
GameObject childObjectToAttach; void Awake() { if(!photonView.isMIne) return; childObjectToAttach = GameObject.FindGameObjectWithTag ("PlayerChild"); childObjectToAttach.transform.parent = transform; }If I attached the childObject like that, will the position and rotation auto-sync?
Want I want to do is, after Instanstiate player through PhotonNetwork function, i want to attached an existing game object to it and sync its position and rotation across the network.
Please advise, thanks.
0
Comments
-
Hello, anyone?0
-
Hey,
someone?0 -
does it have a photon view attached?
But I don't think it will be synced if u just child it.
Try to add a photonview to sync position and rotrotation.
If you attach a PhotonView and leave these OBject's in the scwne it will be a sceneObject and controlled by the MasterClient so every other client has to request the ownership to sync it.0