Page 1 of 1

Flashing Selector Elements

Posted: Sat Feb 03, 2024 1:55 pm
by davidthebard
Hi! I'm having trouble getting the UI Selector elements to show up properly on my game objects with Usable components. Whenever the player is within the selection distance and targeting a game object with Usable, the UI Selector element flashes repeatedly. The issue seems to be exacerbated whenever the object has edges that aren't perfectly flat, or when the center of the screen is near the edge of the object.

I've got the max selection distance set to 5 on the player's Selector component, and 30 on the Usables. Select At is set to center of screen, and the player has a Selector Follow Target component with an offset of 0, 0, 0.

Attached are some screenshots demonstrating the change in position, and here's a video:

Re: Flashing Selector Elements

Posted: Sat Feb 03, 2024 4:19 pm
by Tony Li
Hi,

You can remove Selector Follow Target. That's for the IMGUI (OnGUI) version of the selector UI.

Instead, if you want a selection UI to appear over the Usable object instead of at the top of the screen in screen space, duplicate the "Basic Standard Usable UI" prefab and move the duplicate into your own prefabs folder. Then add an instance of this prefab as a child of your Usable object.

Re: Flashing Selector Elements

Posted: Sat Feb 03, 2024 9:23 pm
by davidthebard
Thanks so much for your help Tony! That resolved the issue with the position shifting, but the Basic Standard Usable UI component is still flashing repeatedly whenever it shows up on meshes that aren't perfectly flat. For example it doesn't flash on a door model (except when the very edge of it is targeted), but it does flash on a potion bottle.

Any idea what the problem there could be?

Re: Flashing Selector Elements

Posted: Sat Feb 03, 2024 10:03 pm
by Tony Li
Hi,

The Selector detects colliders, not meshes. It's possible that some other collider is animating just slightly in front of the selector's raycast. Here are two ways to solve it:

1. Try ticking Raycast All. This will allow it to go through non-Usable colliders to detect Usables.

2. Or tick Debug. Keep an eye on the Scene view while playing. The Selector will draw a raycast from the camera. If it hits a Usable, it will draw a green wire sphere at the hit point. If it hits something else, it will draw a red sphere. This may help you determine what's intermittently blocking the raycast. Once you identify it, you could put it on a layer that's not in the Selector's Layer Mask.

If that doesn't help, check if the Selector or Selector Use UI Elements or Standard UI Selector Elements components are being disabled and re-enabled. The latter component is on the UI elements in the Dialogue Manager's Canvas.

Re: Flashing Selector Elements

Posted: Sat Feb 03, 2024 10:18 pm
by davidthebard
Thanks Tony, it looks like the capsule collider on the Player was causing the issue, as removing it seems to have resolved the problem.

I'm not entirely sure why, as the Player and camera (which is a child object of the player) are set to a layer which isn't among the layers set in the layer mask of the Selector.

In any case, the issue's resolved, thanks again!

Re: Flashing Selector Elements

Posted: Sun Feb 04, 2024 8:48 am
by Tony Li
Glad to help!