The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Enable Unity's Ui only for the player how triggered it

2016-05-20 06:30:32


I am having quite a hard time trying to find a solution to my problem.
I am trying to activate a panel with Unity's new UI, but this panel to be active only on the screen of the player who triggered it and not to the others. I am trying to use photonView.isMine but it is not behaving as it should. the problem for this is that if I trigger the panel on a view that is not mine, it shows the panel only on my view, so this is not what I need. I need the panel to be shown only on the screen of the player who triggered it.
Your help would be much appreciated.


2016-05-20 13:32:00

If you only need to show it on the player who triggered it, why use network synchronization at all for that?
You can simply use it like any local UI.

2016-05-20 13:37:39

Thank you for your answer. The thing is that if I activate/instantiate a gameobject using SetActive/Instantiate this action is automatically visible in all instances of the game. I'm not syncronising anything with PhotonView - but the gameobject is visible for all players. I spent hours to find a solution for this. Would a code snippet from my project be useful?

2016-05-20 14:03:32

I use network synchronozation in my game for the chat system and I also synchronize many of the actions inside the game, but some UI Panels I preffer them to b visible only local, for the player who triggered it. Is it possible to achieve this using Photon and can you please point me in the right direction of doing this?


2016-05-20 15:00:59

Remove PhotonView component from UI panel. This will break synchronization and make panels appearance independent on all clients.

2016-05-20 15:15:07

I have tried this, first thing, activating an UI Panel without any PhotonView Component.
I even tried activating locally a cube, again without any PhotonView Component.
In both cases, it is not behaving as expected, both gameobjects are activated on all Player Views, even if they do not have a PhotonView component on them. :(
So, I really do not what to do next ..

2016-05-20 15:30:07

Would be interesting to look at simple repro app where cubes synchronized w/o PhotonView's.
How do you "activate" cubes, by the way?

2016-05-20 15:39:21

I activate them as I would without any PhotonView component.
Hitting a collider, OnTriggerEnter(Collier col) and then cube.setActive(true).

2016-05-21 08:30:33


No one can point in the proper direction of solving my issue?

2016-05-23 08:30:21


So I've found what is causing the first appearance of a panel for all players, when triggered.
The player prefab, which I instantiate OnJoinedRoom and which triggers the panel has a PhotonTransformView script and this is set to the Observe option of the PhotonView.
The Observe option is set to "Unreliable on Change". If turn it off I get the behaviour I need for the UI Panels, but the movement of the character is no longer synchronized.
So my question is, can I change the Observe option of the PhotonView by script, during game-play? For example, to switch it from "Unreliable on Change" to "Off" when hitting a collider?


2016-05-30 14:07:22

You definitely should separate functionality and decouple gui from player object. So that state of player never affects gui state.
To change gui state, send messages to it when required.

2018-11-05 13:32:46

I am also having the same problem

2021-02-27 20:12:23

So i came across this issue when i had a "chest" that had a photon view to update its opening animation for all players in the game. However the "loot window" only needed to open for the current player that walked up to it. I handled telling the chest to "open" using a trigger collider on the player. Since both the chest and the player had photon views, when telling the loot window to open all players would open it. I could not use the owner of the view of the chest as it was always set to who ever started the room, and would only open the menu for that player in that case no matter who opened it. So to solve this when a player walked up to it i not only passed a variable to trigger the animation (if it wasnt already triggered), i also passed the "lootable" chest the view of the player whos collider hit it, then was able to make it open the correct menu for the right player using:


2021-02-27 20:13:02

FYI im very new to photon, idk if this was ideal but it works

Back to top