Standard Usable UI and Standard UI Selector Elements

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
eugeen
Posts: 6
Joined: Wed Mar 15, 2023 4:48 am

Standard Usable UI and Standard UI Selector Elements

Post by eugeen »

Hi! I'm a bit confused about what to use: there's Standard Usable UI that comes with a prefab and there's also Standard UI Selector Elements that is mentioned in the documentation.
What I want to achieve: I want a UI showing above a usable NPC when Player gets close to it.
Player has Proximity Selector and Selector Use Standard UI Elements and NPC has Usable component but what's next?
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Standard Usable UI and Standard UI Selector Elements

Post by Tony Li »

Hi,

Now duplicate the Basic Standard Usable UI and move the duplicate into your own folder.

Then add an instance of the duplicate as a child of your NPC. When the Player gets close, the Proximity Selector will activate this GameObject.

Once you've confirmed that this works, you can customize your duplicate prefab and add instances to other NPCs.
eugeen
Posts: 6
Joined: Wed Mar 15, 2023 4:48 am

Re: Standard Usable UI and Standard UI Selector Elements

Post by eugeen »

Hi!
For some reason it doesn't work. On play start the canvas of the Usable UI gets disabled and doesn't enable on approaching it. I see that in the Standard Usable UI there's Show() method where the canvas enables but maybe it doesn't get called for some reason. Probably worth mentioning that if I select Use Default GUI bool on Proximity Selector it indeed shows the sign on top of the screen so the problem is not in Proximity Selector but somewhere else.
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Standard Usable UI and Standard UI Selector Elements

Post by Tony Li »

Hi,

Does your player GameObject still have Proximity Selector and Selector Use Standard UI Elements components on the same GameObject (e.g., the player's top-level GameObject), and is the Selector Use Standard UI Elements enabled? The Selector Use Standard UI Elements is what tells the Standard Usable UI to show its canvas.

If you want to see a Standard Usable UI in action, open DemoScene1 and add the Basic Standard Usable UI prefab to Private Hart. Then play and run up to Private Hart.
eugeen
Posts: 6
Joined: Wed Mar 15, 2023 4:48 am

Re: Standard Usable UI and Standard UI Selector Elements

Post by eugeen »

I finally got it to work! The thing was that I didn't include Standard UI Selector Elements in Instantiate Prefabs component.
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Standard Usable UI and Standard UI Selector Elements

Post by Tony Li »

Glad you got it working. Thanks for the update!
Post Reply