Proximity Selector and Timeline

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
alexjet1000
Posts: 18
Joined: Thu Oct 01, 2020 11:18 am

Proximity Selector and Timeline

Post by alexjet1000 »

Hi!

Im trying to hide the UI for the proximity selector (the custom, not legacy) while on Cutscenes (Timelines).
The problem is that i can manually disable this components, but the dialogue manager automatically seems to re-enable
them when the conversation finishes within the timeline (ex. for a Continue Clip).

So even if i disable the ProximitySelector component and the UI panel for the selector, it re-enables it after the conversation has finished (but the timeline hasnt).

How could i control this?

Thanks!
User avatar
Tony Li
Posts: 22125
Joined: Thu Jul 18, 2013 1:27 pm

Re: Proximity Selector and Timeline

Post by Tony Li »

Hi,

The easiest way is to make your timeline deactivate the Standard UI Selector Elements GameObject. You might want to add it to a Canvas inside your Dialogue Manager instead of relying on the Dialogue Manager's Instantiate Prefabs component to instantiate a copy at runtime.

If you can't / don't want to add an instance, you can write a script to get it at runtime. Example:

Code: Select all

FindObjectOfType<SelectorUseStandardUIElements>().elements.gameObject.SetActive(false);
Or, if you add a Canvas directly to your Standard UI Selector Elements, you can disable the Canvas instead:

Code: Select all

FindObjectOfType<SelectorUseStandardUIElements>().elements.GetComponent<Canvas>().enabled = false;
alexjet1000
Posts: 18
Joined: Thu Oct 01, 2020 11:18 am

Re: Proximity Selector and Timeline

Post by alexjet1000 »

Hey!

Disabling the Standard UI selector works great!

Also, im wondering.
Is there any built in way of disabling the proximity selector or any interaction at the start of the scene?
That way the player cant continously press when the scene isnt comepletely showing yet, avoiding unwanted interactions before other things are loaded.
User avatar
Tony Li
Posts: 22125
Joined: Thu Jul 18, 2013 1:27 pm

Re: Proximity Selector and Timeline

Post by Tony Li »

You can set it disabled at design time, and enable it after a duration using a TimedEvent component.
alexjet1000
Posts: 18
Joined: Thu Oct 01, 2020 11:18 am

Re: Proximity Selector and Timeline

Post by alexjet1000 »

I just tried this, only problem is that the Proximity Selector works OnTriggerEnter, so once i re-enable the component the usable UI is not showing unless i go out and in the trigger again, for small gameobjects is okay, but for big trigger areas not that good.
I could add the timedEvent to the usables instead, but i feel it would be better to control this via player gameObect only.

What do you think?
User avatar
Tony Li
Posts: 22125
Joined: Thu Jul 18, 2013 1:27 pm

Re: Proximity Selector and Timeline

Post by Tony Li »

Good point. Here are two different ways you could handle that:

1. Disable all Dialogue System input for a short duration. Add a script to the scene with a Start() method like this:

Code: Select all

IEnumerator Start()
{
    DialogueManager.SetDialogueSystemInput(false);
    yield return new WaitForSeconds(1); // Wait 1 second.
    DialogueManager.SetDialogueSystemInput(true);
}
2. Or make and use a subclass of ProximitySelector. Something like:

Code: Select all

public class CustomProximitySelector : ProximitySelector
{
    public bool allowInput = true;
    
    protected override bool IsUseButtonDown()
    {
        return allowInput && base.IsUseButtonDown();
    }
}
Then set CustomProximitySelector.allowInput false for a duration. You could even do this in the subclass's Start() method:

Code: Select all

public override void Start()
{
    base.Start();
    allowInput = false;
    Invoke(nameof(AllowInput), 1);
}
void AllowInput() { allowInput = true; }
alexjet1000
Posts: 18
Joined: Thu Oct 01, 2020 11:18 am

Re: Proximity Selector and Timeline

Post by alexjet1000 »

Thank you Tony, i appreciate very much your help.
I will be using option number 1 so the whole input is off until the scene is correctly loaded.

Thank you again and have a nice day :)
User avatar
Tony Li
Posts: 22125
Joined: Thu Jul 18, 2013 1:27 pm

Re: Proximity Selector and Timeline

Post by Tony Li »

Happy to help!
Post Reply