This works with the inventory choice button as a whole item.
Is there a way to start it from 'Additional content' e.g. toggle button?
I need that toggle to pass on data about item that is in the button through variable 'action' but can't find a way through it.
Tried using the 'OnValueChanged' function on the toggle, where I dragged the choice button of the menu and utilizing the 'UIButtonInput' script that it has but without luck.
You can e.g. add a machine component to that button to start a separate schematic, but that doesn't have access to the item.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
That would be helpful. Right now, it can only be called.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
E.g. you have inventory, where each item can be sold by one icon on the button...then equipped by clickong on other icon and so on...
I have a shopping/crafting game with advanced menus, there has to be multi function. Clicking one button is weird, but for now better than nothing :)
Generally, the item (or ability, etc.) of a button is available via the content of the UI Button Input component, so we'd just need a way to get that from the button's game object for machines started on it.
Edit: Next update (of Makinom) will add the Select UI Input Context node for this.
You can use it to get the context added to the buttons and store it in selected data. E.g. ORK's inventory menu adds the item to the buttons used to display them as their context information.
The new node allows your machines on the button to get the item from there and use it.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Thanks a lot!
- add a machine component to your button prefab (with the UI Button Input component), e.g. starting the machine via some additional button added somewhere
- the schematic uses the new Select UI Input Context node to get the context from the button (machine object) and stores it into selected data (e.g. as action key)
- the schematic can now access that information like in the sub-menu schematics :)
The context of the button is automatically set by the menu parts, e.g. inventory menus will add the item the button represents as the context of the button, or ability menus the ability, etc.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Can I somehow link the state of attached toggle button to an item variable bool from the button component of an Inventory menu?
E.g. my items have 'ForSale' bool variable that sets on or off depending if my item is on sale. I'd like to control that toggle also on or off based on that variable, but custom content with bool doesn't seem to work with it when I use UI Toggle Content. Thanks :)
I think I can do it through String variables displaying different images, just thought to use Bool to be more convenient.
E.g. have an Auto Machine on the button to execute when the button is enabled (i.e. start type Enable) to get the context item from the button and use an UI Toggle to change a Toggle component's state based on the item's variable.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
When you have 2 or more items with a bool and it is bound to a Unity UI toggle, when the first one is being removed from inventory by the node Remove from inventory while the UI Toggle is ON, it will cause the next item to inherit the first one's Unity UI toggle value, thus turning it ON as well while it's item variable bool remains OFF. So it switches the outcome of the Auto Machine.
Only happens when you remove the item of first index. If I remove item with higher index in Inventory with a UI Toggle ON, the item with first index has UI Toggle OFF, as it should :)
I have UI Color Changer script attached to the gameobject with the toggle with 'In Children' off. There is no change even when it's on though.
You can try adding a Restart Schematic node at the end of the schematic to keep executing it, i.e. it'll update each frame. Might be a bit performance heavy when you have a lot of buttons, though.
I'll look for a better solution.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!