Page 1 of 1

Hide Proximity Selector UI Children

Posted: Sun Jan 30, 2022 9:42 pm
by PayasoPrince
Hello,

I need to be able to hide the ProximitySelectors "Name Text" & "Use Message Text" through script.

How can I do this through my Player GameObject that contains the ProximitySelector?

Image

Is it something like this?

Code: Select all

"ProximitySelector" ..transform.GetChild(1).GetChild(0)
or is there a simpler way?

Re: Hide Proximity Selector UI Children

Posted: Sun Jan 30, 2022 9:47 pm
by Tony Li
If you disable the ProximitySelector component, it should automatically hide its UI elements.

Re: Hide Proximity Selector UI Children

Posted: Sun Jan 30, 2022 9:56 pm
by PayasoPrince
Hmm, the ProximitySelector script that is on my player?
Disabling it doesn't seem to also disable the UI :?

Unless you meant the ProximitySelector Prefab that is on my DialogueManager. If so, can you assist with how I can syntactically disable it?

Re: Hide Proximity Selector UI Children

Posted: Sun Jan 30, 2022 10:32 pm
by Tony Li
Disabling the ProximitySelector on your player should tell the SelectorUseStandardUIElements component on your player to hide the StandardUISelectorElements in your canvas.

Re: Hide Proximity Selector UI Children

Posted: Mon Jan 31, 2022 11:35 am
by PayasoPrince
Hello Tony,

That doesn't appear to be the case for me.

Code: Select all

"this(Player)".GetComponent<ProximitySelector>().enabled = false;
This is successfully disabling my ProximitySelector component but is not removing the UI.

Please see example below:

[removed]

Any assistance would be greatly appreciated. :)

Re: Hide Proximity Selector UI Children

Posted: Mon Jan 31, 2022 12:07 pm
by Tony Li
Sorry, I miswrote. To hide it, you can use:

Code: Select all

"this(Player)".GetComponent<SelectorUseStandardUIElements>().elements.mainGraphic.gameObject.SetActive(false);

Re: Hide Proximity Selector UI Children

Posted: Mon Jan 31, 2022 1:03 pm
by PayasoPrince
This works! Thanks! :mrgreen:

Re: Hide Proximity Selector UI Children

Posted: Mon Jan 31, 2022 1:18 pm
by Tony Li
Glad to help!