Search Unity

Super Unity Behaviour Question

Discussion in 'Visual Scripting' started by ForrestRiver, Jun 7, 2021.

  1. ForrestRiver

    ForrestRiver

    Joined:
    Feb 6, 2019
    Posts:
    5
    Hi, I'm just trying to get a feel of Bolt / visual scripting in Unity and have found some strangeness and just wondered what going on.

    I have a macro attached to an empty object in a scene, in the macro I have a very simple super unit macro, all it does it output an int.

    With the output int from the super unit I am setting a new saved variable.

    When it runs it saves the variable inside the super unit, not the macro above that the super unity sits in as I assumed would happen.
    bolt_super_unit.jpg


    Sorry for new newbie questions, I'm probably going to be asking a lot
     
  2. ForrestRiver

    ForrestRiver

    Joined:
    Feb 6, 2019
    Posts:
    5
    Hey, found out what was wrong (kind of).
    No matter what I did the saved variable would update in the super unit not the macro it sits in. Even strangely when I disconnected it. I deleted the super unit then found out that none of my variables updated in the macro.

    In the end I reinstalled bolt and got one variable to work though oddly it took a couple of time running the scene before it did.

    I have no idea what happened but its been fine since...

    If any one had any ideas what happened it would be good, i really enjoying bolt / visual scripting but I am scared this is going to happen again at some point
     
  3. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,073
    There's no such thing as macro or superunit saving. Saved Variables save values of type integer, float, string and bool. You're passing the int through the superunit and that int value is then saved. If you want the macro to get the saved int value, then you must use a "Get Saved Variable" node similarly to how you Set the variable.

    And any literal node, including integer literal won't update at runtime no matter if its value is saved or not. It's a value you set once by hand and it'll always stay at that (literal) value. If you're intending for the macro/superunit to dynamically update the integer value, you must use a variable.
     
    Last edited: Jun 9, 2021
    ForrestRiver likes this.
  4. ForrestRiver

    ForrestRiver

    Joined:
    Feb 6, 2019
    Posts:
    5
    Thanks:), I'm sure what I'm seeing is a lot of me just misunderstanding how the systems work.

    The data I was originally saving was a list containing lists of ints to mimic a 3d array, my flow graph was creating one in saved variables, once I had this working I made a super unit version that returned the content of a list made inside the super unit and set it with the set variable in the macro the super unit was sitting in, it was originally embedded and worked well.

    When I changed the super unit to a macro its self instead of embedded and thats when things stopped coming out of the super unit. I made my example just to simplify what I was doing to see if I could find where I was going wrong, the int literal was just a stand in for the data I was returning. Does this mean it is possible to get a variable out of a super unit using get variable?

    Right now I'm just using embedded super units in case it happens again.
     
  5. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,073
    You can have Get Variable nodes in superunits that output their values outside the macro. You just might need to set it to a graph variable and Get it before outputting it if you're getting "can't fetch dynamically" type of errors. But I'm still not totally getting your issue. Perhaps you can post more complex visual examples of what exactly is not working out for you.

    If you're looking for a multidimensional array support, Community Addons implements that functionality. They have both Bolt 1.4 and UVS 1.5.2 compatible versions: https://github.com/RealityStop/Bolt.Addons.Community
     
    Last edited: Jun 10, 2021
    ForrestRiver likes this.