Image/Icon above object for Proximity Selector

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
RetroVertigo
Posts: 55
Joined: Fri Apr 16, 2021 4:32 pm

Image/Icon above object for Proximity Selector

Post by RetroVertigo »

I wanted to see if I could have an icon or image above an NPCs head when close enough to talk to them. I know I can have a Use Message with Proximity Selector, but is there a way to use that to have an image or icon above the GO/NPCs head? I appreciate any help or insight I can get on this.
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Image/Icon above object for Proximity Selector

Post by Tony Li »

Hi,

Yes. Add an instance of the 'Basic Standard Usable UI' prefab to the NPC. Then customize its appearance.
RetroVertigo
Posts: 55
Joined: Fri Apr 16, 2021 4:32 pm

Re: Image/Icon above object for Proximity Selector

Post by RetroVertigo »

Thanks for the reply! Do I just need to add the Basic Standard UI prefab as a child? Is there any documentation on the prefab or usage like this?
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Image/Icon above object for Proximity Selector

Post by Tony Li »

Hi,

Set up everything else as before, where it shows the use message at the top of the screen.

Then add an instance of the 'Basic Standard Usable UI' as a child of the NPC. You don't need to do anything else. The Proximity Selector will check if the NPC's hierarchy has a (Basic) Standard Usable UI. If so, it will show it instead of showing the use message at the top of the screen.
RetroVertigo
Posts: 55
Joined: Fri Apr 16, 2021 4:32 pm

Re: Image/Icon above object for Proximity Selector

Post by RetroVertigo »

OK, so I tried that and it is still only showing the message at the top of the screen, BUT if I enable the Canvas on the Basic Standard Usable UI prefab, then it appears. Should this be enabling automatically or should I be adding something in my code for it? I do have that message that the scene is missing an event system. Maybe that is the issue?

Image
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Image/Icon above object for Proximity Selector

Post by Tony Li »

Hi,

Add a 'Selector Use Standard UI Elements' component to the GameObject with the Proximity Selector if it doesn't already have one.

The EventSystem warning isn't the issue. That's just letting you know that the Dialogue System is adding an EventSystem because the scene doesn't have one. The dialogue UI uses Unity UI, which requires an EventSystem for interaction.
RetroVertigo
Posts: 55
Joined: Fri Apr 16, 2021 4:32 pm

Re: Image/Icon above object for Proximity Selector

Post by RetroVertigo »

That did the trick. Thanks SO MUCH! this asset is really awesome. I am still working through some other stuff, so I might have other questions. Again, thanks for sticking with me through this!
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Image/Icon above object for Proximity Selector

Post by Tony Li »

Glad to help! :-)
Post Reply