How to display things differently to different players
Answers
-
Hi LBN,
It depends on the structure from your player and how you instantiate them in a room. Most of the time people do this with a game manager, which instantiates and destroys players in a game.
Solution:
Every new player who joins the room in the game scene looks at their own PhotonView (which you need to communicate and send different data, like position and rotation) and checks if they are the owner of this object. If the condition returns true destroy the head. At the end will every other player have a head except the owner of the player, like you wanted it to be.
The possible code could look like this:
_______________________________________________________________________
using Photon.Pun;
PhotonView PV;
[SerializeField] private GameObject playerHead;
private void Awake(){
PV= GetComponent<PhotonView>();
}
private void Start(){
DestroyHeadFromOwner();
}
public void DestroyHeadFromOwner(){
(if PhotonView.isMine) {
Destroy(playerHead);
}
}
_______________________________________________________________________
Don't forget to put the head object in the playerHead field where the script is.
I hope I could help you,
Vallekralle
0 -
Vallekralle, OP is using Fusion, not PUN, so this unfortunately won't work.
Object.InputAuthority can be used to poll whether an object "belongs" to the local client.
1