Hi!
I'm trying to make a menu with a cursor that makes a flashing effect underneath the selected option. I've set up the cursor like in the tutorial (
https://orkframework.com/guide/tutorials/ui-setups/unity-ui-ui-box/) and it works well.
However, since the only input the menu can accept is mouse clicking, I'd like the cursor to only appear when the mouse is over the menu option. As it is right now, the cursor stays over the last menu option the cursor was over, even after the mouse has gone away. The cursor also shows by default over the first menu option, even if the mouse never went over it.
Is there a component that can help achieve that effect?
Thank you!
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Edit: After looking into the mouse enter/exit thing, I've ended up finding the solution by asking Chat GPT lol.
As a Unity noob and a non-scripter, I'm posting my solution to help out other people with skills similar to mine.
I've been able to create a ''cursor'' around my skill buttons in the battle menu by adding a component to my Skill Button prefab (I tried to make it work with the real cursor in the menu, as shown in the tutorials, but I haven't been able to make it disappear with the mouse, maybe I did a mistake). So open your Skill Buttons prefab, and do the following:
Create a UI Image:
Go to GameObject → UI → Image in the Hierarchy.
Assign a sprite to the Image component.
Add an Event Trigger Component:
Select the Image in the Hierarchy.
Click Add Component in the Inspector.
Search for and add EventTrigger.
Set Up Pointer Events:
Click Add New Event Type.
Choose Pointer Enter and Pointer Exit.
Assign Actions:
Drag the Image object into the slot.
Click No Function and select:
GameObject.SetActive → false (for Pointer Exit).
GameObject.SetActive → true (for Pointer Enter).
The component should be in the parent object (the button itself) and the image that appears/disappears should be the child.
Also, make sure to disable to the Image child object in the prefab, otherwise it'll show up automatically in the menu before you interact with icons.
Hope it helps :)