- Home /
How to handle having text show in one game object by hovering over another.
Hello,
I am currently developing the UI for my game and I want to incorporate this feature - - There will be a list of characters that the player can choose from. I want it so that when the user hovers their mouse over one character entry in the list, that character's basic info such as name and job specialty will be shown on another separate UI panel.
What I'm trying to do is create the code that will do the following:
Take the text from the Text game object that the mouse will hover over.
assign that value to a text field in another Text game object.
Here is a picture so you all have a better idea.
I eventually want it so that whichever name you highlight will be the one shown In the Commander Name Text box. So far I have been able to attach a script to the box I want the mouse to hover over with sucessfully executing an OnMouseOver() method. I am not too sure where to go from here, though. Do I set it up so that all of the character's names are stored in a list so that they can be accessed through another game object with a script the manages the menu? Or do I set up an event system where both text boxes can listen to each other without any dependencies? If the latter, how I would I set up the event system? Would I need to make a specific id for every name I add to a list and then the event manager searches for the highlighted name by id? I'm not sure where to go from here and any help is appreciated.