[PUN] I want people to see my GUI

so what i am trying to achieve is when i press escape it doesn’t open the other players GUI just mine, but the other players can see my GUI, i am using 4.6 world space gui.

i can open my gui but they dont see it at the moment.

@Landern It's pretty obvious what he wants. Goal: He hits the escape key, it opens his gui, and other players should be able to see it. What he has currently: He can open his gui, but the other players don't see it.

@kacyesp have at it.

is there any way to do this?

i dont know why the top part of the code didn't turn into the code thing , i clicked the binary thing.

the concept will help me with other things such as the facial animations, the hp bar and what not, maybe an object stats manager? or something. I'm not that great at networking... I have more experience with modeling and animation

2 Answers

2

Hey,

I’ve seen some games with what you want. There is a couple ways to do this that I can think of. I kind of touched on one already which I will explain more on.

Basically it would be easier to make something to appear as the menu then to be a actual GUI. If you want to do a real GUI it would take some work but can be done. In a very similar way that I have made here.

In the screenshot, I have a cube scaled and a texture of a GUI on it. No real GUI.

The way I have made here is pretty straight forward. And you could change it to anything that you would want.

public bool menuTT = false;
public GameObject menuGUI;

void Start () {
	menuGUI.SetActive(false);

}

void Update (){

	if (networkView.isMine && Input.GetKeyUp (KeyCode.N) && menuTT == true){
		menuTT = false;
		networkView.RPC("Menufl", RPCMode.OthersBuffered, menuTT);
		}

	if (networkView.isMine && Input.GetKeyUp (KeyCode.M) && menuTT == false) {
		menuTT = true;
		networkView.RPC("Menutr", RPCMode.OthersBuffered, menuTT);

		}

	if (menuTT == true && networkView.isMine){
		menuGUI.SetActive(true);
    	}

	if (menuTT == false && networkView.isMine){
		menuGUI.SetActive(false);
		}
}

[RPC]
void Menutr(bool menuTT)
{
	menuGUI.SetActive(true);
}
	
[RPC]
void Menufl(bool menuTT)
{
	menuGUI.SetActive(false);
}

It works 100% tested it. You have to change it over to Photon’s Networking though since its just using Unity’s networking.

thanks, but ive done mine a slightly different way, both work i assume, just on your one, if a player had a gui opened if a player connected they wouldnt see if it was open or not (i think), anywhoo i cant up load the code because its too large, so heres the link on gist: link text

No problem, Yeah from what I saw of yours it should work. And yes mine isn't buffered so it wouldn't appear for people connecting while its open. But I changed the script to fix that now. And it would be easy to fix that to have it work with the actual GUI and have the everything appear as it is on the other players. Glad you were able to get it working though :) Watched the videos of you're game on youtube. It is looking pretty good! I'll keep my eye on it :D