Search Unity

Resolved Get Variable unit gets evaluated although the path is not executed

Discussion in 'Visual Scripting' started by McGravity, Sep 27, 2021.

  1. McGravity

    McGravity

    Joined:
    Nov 2, 2013
    Posts:
    60
    I don't understand why the Get Variable unit on the bottom left gets evaluated although the Branch unit on the left is not going any further. The second connection of the Get Variable unit which is cut on the right doesn't matter, I already tested without this connection.



    This leads to a problem when I want to set the Bait Variable to null. The GetCharacterRoot unit will than throw an error that its target is not set. Which is true but I don't understand why it needs to check as it is not executed. How can I prevent this behaviour? I use Bolt 1.4.15 and Unity 2020.3.18f1
     
    Last edited: Sep 27, 2021
  2. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,079
    Looks like something (perhaps On Exit State) down the line requires the output of GetComponentInChildren node which triggers the whole chain retroactively. Though I might be wrong. Paste in the whole graph.
     
  3. McGravity

    McGravity

    Joined:
    Nov 2, 2013
    Posts:
    60
    This Flow Graph doesn't use an On Exit Sate unit. Every unit that comes to the right is only chained at the On Enter State unit.
     
  4. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,079
    Could it be that IsHooked condition is initially false, then executes the logic, then sets it to True? Is the logic perhaps triggering twice in a row? The result you're getting is indeed confusing.
     
  5. McGravity

    McGravity

    Joined:
    Nov 2, 2013
    Posts:
    60
    I found out what the problem was. Unfortunately I can't provide a screenshot as I already rearranged the graph.

    The Problem was a Custom Event unit. As they have no Invoke Input (no edge telling the unit when to start) they start as soon as entering the state. The target GameObject of the Custom Event unit is the QteManager as seen in the GetComponentInChildren unit in the gif I originally posted. So this unit was triggering the evaluation of the Get Variable unit. My bad :)