Hi all
I get this prompt above my NPC when you get close to them.
I want to edit it, or remove it. Ideally I want the prompt to appear above their heads, and I have an existing speech bubble prefab that I want to use.
I can't find a mention of this notification in the UI specs within the docs, though I'm sure I saw the text as a parameter in the inspector somewhere (can't find it now).
Any ideas on how to remove it?
Olly
Editing/removing this prompt
Re: Editing/removing this prompt
Hi Olly,
That prompt comes from a Selector or Proximity Selector component. (See Selectors & Usables for details and screenshots.) In this reply, I'll refer to both as Selector.
The whole Selector & Usable system is entirely optional. The Dialogue System provides it as a convenience, but you don't have to use it. You can use your own interaction system if you want. For the rest of this reply, I'll assume you want to continue using it, and I'll describe how to customize its appearance.
When the Selector detects an NPC with a Usable component, it shows the prompt in your screenshot.
If the Selector's GameObject also has a Selector Use Standard UI Elements component, it will show the prompt using a set of UI elements. By default, the Dialogue Manager's Instantiate Prefabs component instantiates a prefab named "Basic Standard UI Selector Elements". The Selector will show the prompt using the UI elements in this prefab.
If the Selector's GameObject doesn't have a Selector Use Standard UI Elements component, it will show the prompt using legacy Unity GUI.
However, if your NPC has its own UI elements connected to a Standard Usable UI component, then the Selector will show these UI elements instead of the prompt.
With that information, here's one way to show your existing speech bubble prefab when you get close to the NPC:
1. Add an instance of your speech bubble prefab as a child of the NPC.
2. Add a Standard Usable UI component to your NPC.
3. Assign the speech bubble's UI elements to the Standard Usable UI component.
The advantage of the steps above is that you can set up show and hide animations -- so, for example, the speech bubble can fade in, or pop in using an animation.
Alternatively, you can skip all of that and do these steps:
1. Remove the Selector Use Standard UI Elements component.
2. Remove the Basic Standard UI Selector Elements from the Instantiate Prefabs component's list.
3. Add an instance of your speech bubble prefab to the NPC and deactivate it.
4. Configure the NPC's Usable component > Events > OnSelect() event to activate the speech bubble, and OnDeselect() and OnUse() to deactivate it.
That prompt comes from a Selector or Proximity Selector component. (See Selectors & Usables for details and screenshots.) In this reply, I'll refer to both as Selector.
The whole Selector & Usable system is entirely optional. The Dialogue System provides it as a convenience, but you don't have to use it. You can use your own interaction system if you want. For the rest of this reply, I'll assume you want to continue using it, and I'll describe how to customize its appearance.
When the Selector detects an NPC with a Usable component, it shows the prompt in your screenshot.
If the Selector's GameObject also has a Selector Use Standard UI Elements component, it will show the prompt using a set of UI elements. By default, the Dialogue Manager's Instantiate Prefabs component instantiates a prefab named "Basic Standard UI Selector Elements". The Selector will show the prompt using the UI elements in this prefab.
If the Selector's GameObject doesn't have a Selector Use Standard UI Elements component, it will show the prompt using legacy Unity GUI.
However, if your NPC has its own UI elements connected to a Standard Usable UI component, then the Selector will show these UI elements instead of the prompt.
With that information, here's one way to show your existing speech bubble prefab when you get close to the NPC:
1. Add an instance of your speech bubble prefab as a child of the NPC.
2. Add a Standard Usable UI component to your NPC.
3. Assign the speech bubble's UI elements to the Standard Usable UI component.
The advantage of the steps above is that you can set up show and hide animations -- so, for example, the speech bubble can fade in, or pop in using an animation.
Alternatively, you can skip all of that and do these steps:
1. Remove the Selector Use Standard UI Elements component.
2. Remove the Basic Standard UI Selector Elements from the Instantiate Prefabs component's list.
3. Add an instance of your speech bubble prefab to the NPC and deactivate it.
4. Configure the NPC's Usable component > Events > OnSelect() event to activate the speech bubble, and OnDeselect() and OnUse() to deactivate it.
Re: Editing/removing this prompt
Thanks Tony
As my bubble is a sprite with an animation, rather than a UI element on a canvas, I decided to go for the last option, which worked a treat.
On to the next challenge
Thanks
As my bubble is a sprite with an animation, rather than a UI element on a canvas, I decided to go for the last option, which worked a treat.
On to the next challenge
Thanks
Re: Editing/removing this prompt
Great! Glad to help.