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.
  • No, there's no support for having another button on your button and start the schematic like that.

    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.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Right, can there be an option to have the Sub-Menu settings for a selected menu item always on?

    That would be helpful. Right now, it can only be called.
  • No, only one thing can be on at a time - and that's the default menu action. Sub-menu stuff can be called via input keys without opening the sub-menu, though.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited August 2022
    I know, thing is, you can't set up a multi functional inventory button without utilizing that 'call step'. Nowadays all menus have many functions built-in the button. There should be a middle step to that.

    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 :)
    Post edited by Machal on
  • edited August 2022
    I'll look into it.
    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.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Hmm, sounds great, even though will need to read it couple of times to understand its full potential :D
    Thanks a lot!
  • edited August 2022
    In short:
    - 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.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited August 2022
    Works great, one question though :)

    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.
    Post edited by Machal on
  • Should be doable with the same Select UI Input Context node.

    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.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited August 2022
    Works great, thanks, but there is a funny bug.

    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.
    Post edited by Machal on
  • Ah, yeah ... update to the button's content doesn't disable/enable the button, so the machine doesn't start again.
    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.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Yes, that too but bigger issue is the Unity UI Toggle being always inherited from the first index button for no reason. This kinda blocks the whole point of using it since it will revert it's function if the first button was ON and second is OFF.
  • Hm, that's strange - each button is it's own prefab instance, executing it's own machine and accessing it's own toggle, unless your schematic e.g. gets all toggle components from root upwards.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Schematic doesn't do anything, it's some Inventory index bug by ORK as it happens before anything and actually ignores the Schematic that should turn it off as it's set to 'Enabled'. And it only does it with the first index.
  • Ok - can you explain the setup to me or send me a Unity test project to contact@orkframework.com?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.