Standard Usable UI vs. Standard UI Selector Elements

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Vielfalt
Posts: 8
Joined: Tue Dec 10, 2024 6:07 am
Location: Austria
Contact:

Standard Usable UI vs. Standard UI Selector Elements

Post by Vielfalt »

Hi, new DS + QM user here 👋

First of all, thanks @Tony for developing these assets with all the documentation and examples! It's a bit of a learning curve for me (senior dev, but new to Unity), but I'm seeing real progress after 2 days, and the goal of having my first quest fully implemented is getting closer :)

In my 2D game, I would like a subtle highlight behind usable objects when the player is close by, and no text.
I got it working, but I have 2 questions to help me understand why it only works one way:

1. What's the difference between Standard Usable UI and Standard UI Selector Elements?

2. Why does my custom Basic Standard Usable UI's canvas only get enabled if I use Standard UI Selector Elements on it, but not with Standard Usable UI? If I use Standard Usable UI, I get the following warning in the console:

Code: Select all

Dialogue System: SelectorUseStandardUIElements can't find a StandardUISelectorElements component in the scene.
UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
PixelCrushers.DialogueSystem.SelectorUseStandardUIElements:Start () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Selector/SelectorUseStandardUIElements.cs:69)
Here's my config:
  • The Player GameObject has a Proximity Selector and a Selector Use Standard UI Elements component.
  • The usable object has a Usable component, which is correctly detected by the Proximity Selector.
  • The usable object has a child which is an instance of my duplicated Basic Standard Usable UI. This has a Standard UI Selector Elements component (works). But it won't work and never enables the canvas with Standard Usable UI.
  • I disabled Instantiate Prefabs in DM, so no Basic Standard UI Selector Elements is created.
User avatar
Tony Li
Posts: 22880
Joined: Thu Jul 18, 2013 1:27 pm

Re: Standard Usable UI vs. Standard UI Selector Elements

Post by Tony Li »

Hi,

I think it just happens to be working as a lucky side effect.

Re-enable the Dialogue Manager's Instantiate Prefabs, and pare the Prefabs list down to the Basic Standard UI Selector Elements prefab.
  • When the ProximitySelector detects a Usable GameObject, it informs the SelectorUseStandardUIElements component.
  • The SelectorUseStandardUIElements component requires a StandardUISelectorElements component to exist somewhere, even if it doesn't end up using it.
  • In your case, it will check the Usable GameObject for a StandardUsableUI component. If one exists, it will tell that StandardUsableUI to become visible instead of showing the StandardUISelectorElements UI.
Technically, if you're showing a highlight without using StandardUsableUI -- for example, using the Usable component's Events > OnSelect event to activate a highlight child GameObject -- then I don't think you actually need any of those components. You could probably get by with only a ProximitySelector on the player and a Usable on the usable GameObject (e.g., NPC).[/list]
User avatar
Vielfalt
Posts: 8
Joined: Tue Dec 10, 2024 6:07 am
Location: Austria
Contact:

Re: Standard Usable UI vs. Standard UI Selector Elements

Post by Vielfalt »

Technically, if you're showing a highlight without using StandardUsableUI -- for example, using the Usable component's Events > OnSelect event to activate a highlight child GameObject -- then I don't think you actually need any of those components. You could probably get by with only a ProximitySelector on the player and a Usable on the usable GameObject
You're absolutely right, this works and simplifies things a lot. Thanks!
User avatar
Tony Li
Posts: 22880
Joined: Thu Jul 18, 2013 1:27 pm

Re: Standard Usable UI vs. Standard UI Selector Elements

Post by Tony Li »

Glad to help!
Post Reply