Page 1 of 1

Standard Usable UI and Standard UI Selector Elements

Posted: Sun May 14, 2023 1:30 pm
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?

Re: Standard Usable UI and Standard UI Selector Elements

Posted: Sun May 14, 2023 9:14 pm
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.

Re: Standard Usable UI and Standard UI Selector Elements

Posted: Mon May 15, 2023 5:40 pm
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.

Re: Standard Usable UI and Standard UI Selector Elements

Posted: Mon May 15, 2023 8:39 pm
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.

Re: Standard Usable UI and Standard UI Selector Elements

Posted: Tue May 16, 2023 5:38 pm
by eugeen
I finally got it to work! The thing was that I didn't include Standard UI Selector Elements in Instantiate Prefabs component.

Re: Standard Usable UI and Standard UI Selector Elements

Posted: Tue May 16, 2023 8:44 pm
by Tony Li
Glad you got it working. Thanks for the update!