Hello , i'm working in a menu that gives me different choices when i click an energy item (example 1), so, i overrided the Use interaction on the items to show the menu ,but now i need to save the last selected item to use it on one of the choices , i though on saving the item ID on click and passing it to the menu button but i can't find a way to store the clicked item ID (after getting the ID i will just select the item again to use it on the game)
Hope my english is good enough , thanks
Example 1: http://prntscr.com/n9mmcw
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I'm afraid I don't follow your meaning too well, but you can use the OnMenuElementClick event to extract the clicked item's ID:
This is an example C# script named "GetItemID.cs". Add it to an empty GameObject in your scene and update the menu/element names on line 25, then check the Console when clicking on the menu.
I actually ended up using this code on the button i needed it like this:
if (_element.title.Equals("MyButton"))
{
KickStarter.runtimeInventory.lastClickedItem.Select();
}
When i click a element in the inventory i appear the Menu and one of them have this code so it uses the last clicked item , but thank you so much anyaways ,i could't figure out if i should add it on a gameobject or add that code on the AC MenuSystem.cs
Don't put it in MenuSystem - you should use events like the one above to hook custom code into AC, and place them on a new GameObject.
More on events can be found in the Manual's "Custom events" chapter, and a tutorial can be found here.