Proximity Selector and Timeline
-
- Posts: 18
- Joined: Thu Oct 01, 2020 11:18 am
Proximity Selector and Timeline
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!
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!
Re: Proximity Selector and Timeline
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:
Or, if you add a Canvas directly to your Standard UI Selector Elements, you can disable the Canvas instead:
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);
Code: Select all
FindObjectOfType<SelectorUseStandardUIElements>().elements.GetComponent<Canvas>().enabled = false;
-
- Posts: 18
- Joined: Thu Oct 01, 2020 11:18 am
Re: Proximity Selector and Timeline
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.
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.
Re: Proximity Selector and Timeline
You can set it disabled at design time, and enable it after a duration using a TimedEvent component.
-
- Posts: 18
- Joined: Thu Oct 01, 2020 11:18 am
Re: Proximity Selector and Timeline
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?
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?
Re: Proximity Selector and Timeline
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:
2. Or make and use a subclass of ProximitySelector. Something like:
Then set CustomProximitySelector.allowInput false for a duration. You could even do this in the subclass's Start() method:
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);
}
Code: Select all
public class CustomProximitySelector : ProximitySelector
{
public bool allowInput = true;
protected override bool IsUseButtonDown()
{
return allowInput && base.IsUseButtonDown();
}
}
Code: Select all
public override void Start()
{
base.Start();
allowInput = false;
Invoke(nameof(AllowInput), 1);
}
void AllowInput() { allowInput = true; }
-
- Posts: 18
- Joined: Thu Oct 01, 2020 11:18 am
Re: Proximity Selector and Timeline
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
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
Re: Proximity Selector and Timeline
Happy to help!