Select Only One Usable at a Time

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
HunterTom
Posts: 18
Joined: Fri Dec 24, 2021 4:58 pm

Select Only One Usable at a Time

Post by HunterTom »

Hi,

I am using the Usable and Dialogue System Trigger to start conversations.

The problem I am having is that my players trigger colliding box is a bit big and sometimes when two usable objects are placed close to each other, they will be selected at the same time. (By "selected", I mean I have an "on trigger enter" on both objects and both of them would appear a yellow outline for example.)

I am wondering if I could achieve the following:
When the second object's "trigger enter" is activated, the first object cannot be selected (disable the Usable temporarily?). So that there is no confusion on which one is currently being selected.

If I didn't explain the question clearly enough please let me know.

Thank you very much!
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: Select Only One Usable at a Time

Post by Tony Li »

Hi,

Are you using a Selector or Proximity Selector component to select Usables? Or your own script?

Selector and Proximity Selector should only select one Usable at a time, even if multiple Usables are close together.
HunterTom
Posts: 18
Joined: Fri Dec 24, 2021 4:58 pm

Re: Select Only One Usable at a Time

Post by HunterTom »

I am using a Proximity Selector (I followed the YouTube tutorial video).

I did see both objects' Dialogue System Trigger got triggered when set to "on trigger enter", however.
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: Select Only One Usable at a Time

Post by Tony Li »

If you're using a Proximity Selector, please set the Dialogue System Triggers to OnUse.

When the Proximity Selector detects multiple Usables, it will select one of them and show its selection info onscreen. (Tip: Add a Selector Use Standard UI Elements to the Proximity Selector GameObject to show the onscreen info using Unity UI.)

When you press the Proximity Selector's Use Key or Use Button, it will send "OnUse" to the Usable. The Dialogue System Trigger will receive this message and perform its actions.

If you want to enable and disable a highlight effect on the selected Usable GameObject, configure the Usable component's Events > OnSelect() and OnDeselect() to enable and disable it. (This assumes your GameObject already has some kind of highlight effect component; the Dialogue System doesn't come with one.)
Post Reply