Hello. Im a begginer on Adventure Creator Asset and Unity Programming.
The general picture is: I have a Menu called "Cellphone_Screen", them inside of it I created 2 items: "Exit_Button" and "Exit_Description"
Im trying to change the visibility of a menu label named "Exit_Description" when the menu button "Exit_Button" is highlighted automatically by the Adventure Creator.
The problem is i dont know what should i do next. The only thing i can do in AC Game Editor in the window of "Exit_Button" is just set an ActionList through a a click type (in other words, just define actions if i press the "Exit_Button").
Menu Elements that i created with AC Game Editor doesnt appear on the Hierarchy window, so i cant place C# inside of them.
The last option i have is to create a C# script to handle this task. However, i dont know how can i create a condition like
if( isHighlighted("Exit_Button") {
setToVisible("Exit_Description", True)
}
if( isNotHighlighted("Exit_Button") {
setToVisible("Exit_Description", False)
}
in C# and using Unity objects and methods in parallel with AC library.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @Henrique16.
Aside from the Manager windows and scene objects, you can run additonal logic using events - either through code, or with the Events Editor.
The Events Editor is available in the top toolbar, under Adventure Creator -> Editors. Create a new Menu / Hover event to get started.
By default, this event will be called whenever any Menu is hovered over. To limit it to your Menu in question, set the Menu name field to match it. Leave the Element name field empty, as it'll need to run both when hovering over Exit_Button and when hovering over anything else.
Click the + icon to create the ActionList, and open it up in the ActionList Editor window. This ActionList uses parameters to provide details of what was hovered over. You can use the Element name string parameter to determine if Exit_Button was hovered over or not, and then hide/show Exit_Description accordingly:
Thanks for the help. It worked. However, it was not what i was imagining.
OnMouseOverMenu works when i move the mouse above the icon of "Exit_Button". The "Exit_Descripton" appears the mouse is above the "Exit_Button".
In the other hand, when i move the mouse out of "Exit_Button" surface, the "Exit_Description" still remains on the screen. I was expecting it to not be visible by the player when "Exit_Button" is not highlighted.
What i will do:
1) i have 3 buttons -> "Call_Button", "Rules_Button" and "Exit_Button".
2) i will create this event for each one (without the skip and hiding themselves part)
3) "Call_Button" when highlighted will hide "Rules_Description" and "Exit_Description"
4) "Rules_Button" when highlighted will hide "Call_Description" and "Exit_Description"
5) "Exit_Button" when highlighted will hide "Call_Description" and "Rules_Description"
The problem i will face -> those buttons are separeted by empty spaces, which are the "Cellphone_Screen". When leaving one of the buttons surface and place the mouse cursor abose those "Cellphone_Screen" empty spaces, the last button highlighted will keep it "_Description" on the are for descriptions in "Cellphone_Screen".
It is possible to use a script if necessary, but did you leave the event's "Element name" field blank? The event should fire when leaving the element as well, in that case.
Are these description labels in the same position? If so, you can reduce them to a single Description label, and use a Global String variable to store its contents. When hovering over each Button, you can then use the Variable: Set Action to change its value to the intended description text.
About this question: did you leave the event's "Element name" field blank?
No. In "Element Name" I wrote Call_Button.
In summary, the condition met runs perfectly. So, what i did was creating empty buttons around the "Exit_Button" and set an event on each of them as the following:
Condition: Equal to
Element_name: Empty_Button_i
If met: Continue ----> Change Type: Hide Menu Element
Not met: stop Element to Hide: Exit_Description
Its not the best way to program, but it works perfectly!
Let me thank you! Your advice really helped me a lot. I could make a good progress on my cellphone interface on Unity's, seriously! ^^
PS: im not finished with the project, so maybe i will run into new problems and will create another post about it.
If you leave "Element name" blank, the event will be called when hovering over the Menu but no Element. Rather than creating Buttons arround Exit_Button, you can use the ActionList: Check parameter Action to compare the "Element name" String parameter with Exit_Button, and react that way.