Add Cursor To Response Menu
- PayasoPrince
- Posts: 104
- Joined: Thu Jan 27, 2022 6:47 pm
Add Cursor To Response Menu
Hello,
I would like to add a cursor that points to the hovered response selection.
I am looking to add something just like this:
What is the best way to accomplish this?
I would like to add a cursor that points to the hovered response selection.
I am looking to add something just like this:
What is the best way to accomplish this?
Re: Add Cursor To Response Menu
The Dialogue System Extras page has an example:
DS_ResponseButtonArrowExample_2022-04-17.unitypackage
The response button has an arrow Image next to it. The Button component's Transition changes the color of arrow. In the normal (unselected) state, the arrow's alpha color is zero (invisible). In the selected state, the arrow's color is visible.
The response button also has an Event Trigger component to play a sound when the button is selected.
DS_ResponseButtonArrowExample_2022-04-17.unitypackage
The response button has an arrow Image next to it. The Button component's Transition changes the color of arrow. In the normal (unselected) state, the arrow's alpha color is zero (invisible). In the selected state, the arrow's color is visible.
The response button also has an Event Trigger component to play a sound when the button is selected.
- PayasoPrince
- Posts: 104
- Joined: Thu Jan 27, 2022 6:47 pm
Re: Add Cursor To Response Menu
Very cool!
If I wanted to set something similar in my own prefab, is it as simple as adding an image to the Response Button Template's Button component?
If I wanted to set something similar in my own prefab, is it as simple as adding an image to the Response Button Template's Button component?
Re: Add Cursor To Response Menu
Yes, just like the example scene.
- PayasoPrince
- Posts: 104
- Joined: Thu Jan 27, 2022 6:47 pm
Re: Add Cursor To Response Menu
Hmm, I feel like I am almost there. For some reason the option that is not hovered will not go transparent. It just goes to a different color shade. I also added a "DeselectPreviousOnPointerEnter" component.
I also noticed that when I copy and pasted your Response Panel, the button itself doesn't seem to highlight anymore. Is there a way to turn that on as well?
I also noticed that when I copy and pasted your Response Panel, the button itself doesn't seem to highlight anymore. Is there a way to turn that on as well?
Re: Add Cursor To Response Menu
Did you assign the arrow to the Button's Transition target graphic?
Make sure the Transition's Normal color > alpha is zero.
If you want to highlight the button background (e.g., the gray bar behind "Yes"), combine the arrow and background into a single image, and change the Transition type to Sprite Swap.
Make sure the Transition's Normal color > alpha is zero.
If you want to highlight the button background (e.g., the gray bar behind "Yes"), combine the arrow and background into a single image, and change the Transition type to Sprite Swap.
- PayasoPrince
- Posts: 104
- Joined: Thu Jan 27, 2022 6:47 pm
Re: Add Cursor To Response Menu
The issue was the Transition's Normal color alpha not being set to zero. It is working now!
In the future, if I wanted to make this more sophisticated and instantiate a game object or add an effect when an option is hovered, would this be possible?
In the future, if I wanted to make this more sophisticated and instantiate a game object or add an effect when an option is hovered, would this be possible?
Re: Add Cursor To Response Menu
Yes. Use an Event Trigger or add a script that implements interfaces such as IPointerEnterHandler.
- PayasoPrince
- Posts: 104
- Joined: Thu Jan 27, 2022 6:47 pm
Re: Add Cursor To Response Menu
Oh. Awesome, thanks!
My last question is - I added an OnSelect()> Play.OneShot() for a sound effect like you did in your example scene. It works great. The only thing I don't like is that it plays the sound effect when the response menu is first created and the player hasn't pressed a button yet.
Is there anyway to have it not play the sound effect when the response menu is first enabled?
My last question is - I added an OnSelect()> Play.OneShot() for a sound effect like you did in your example scene. It works great. The only thing I don't like is that it plays the sound effect when the response menu is first created and the player hasn't pressed a button yet.
Is there anyway to have it not play the sound effect when the response menu is first enabled?
Re: Add Cursor To Response Menu
You might need to add a custom method to do that.