I have the following code which displays a GUI when an object collides with the Player.
I am using the Photon Viking Demo from the Asset store, an when I add this code to an object, the GUI displays for all players in the Scene. I would like it to only display for the player that it collided with.
var showGUI = false;
function OnCollisionEnter (col : Collision)
{
if(col.gameObject.tag == "Player")
{
showGUI = true;
}
}
function OnGUI () {
if (showGUI) {
GUI.Box(new Rect(100,100,100,100),"hey");
}
}
I assume retrieving the Player’s name from Photon might help,
if(col.gameObject.name == GetComponent(PhotonView).owner.name)
But that hasn’t worked either.
I hope that someone can help me here!