Page 1 of 1

Select Only One Usable at a Time

Posted: Sat Dec 25, 2021 3:59 pm
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!

Re: Select Only One Usable at a Time

Posted: Sat Dec 25, 2021 9:06 pm
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.

Re: Select Only One Usable at a Time

Posted: Sun Dec 26, 2021 2:55 am
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.

Re: Select Only One Usable at a Time

Posted: Sun Dec 26, 2021 8:36 am
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.)