Proximity selector in Photon

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
OddCommand24
Posts: 5
Joined: Thu Mar 24, 2022 2:03 pm

Proximity selector in Photon

Post by OddCommand24 »

I am making a multiplayer game and I have assigned the dialogue system to the players and the NPC. However, when there is a player who wants to communicate with the NPC, the default message pops up "Player (spacebar to interact)" on both of the players' screens, even when only one player has actually triggered it. This is a Photon issue which can be fixed by using "PhotonView.isMine" command on the OnTriggerEnter() method which will then only show the message on that particular player's screen, but the problem is that I am unable to find the method of the Dialogue System which makes the default message pop up, so I can't add that code into it. I am assuming it might also be an OnTriggerEnter() method, which I can modify a bit.
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Proximity selector in Photon

Post by Tony Li »

Hi,

Selector and ProximitySelector are provided as a convenience but are entirely optional. If you already have a preferred way to interact with things in your PUN multiplayer setup, you can use that instead. Just configure it to call the Dialogue System Trigger's OnUse() method.

If you want to continue using Selector, by default it uses IMGUI (aka OnGUI) so you'd override its OnGUI() method.

However, the Selector is typically paired with a SelectorUseStandardUIElements component, which disables the Selector's OnGUI() method and tells a separate StandardUISelectorElements component to show a message using Unity UI. You could duplicate SelectorUseStandardUIElements and customze your duplicate copy to only show if PhotonView.isMine.
OddCommand24
Posts: 5
Joined: Thu Mar 24, 2022 2:03 pm

Re: Proximity selector in Photon

Post by OddCommand24 »

Thank you so much for your help! I ended up making my own script in which I called the Dialogue System's OnUse() method instead of the proximity selector. Everything is working fine now.
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Proximity selector in Photon

Post by Tony Li »

Glad to help!
Post Reply