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.