Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bolt visual scripting jumping

Discussion in 'Visual Scripting' started by Confused_Jonas, May 9, 2021.

  1. Confused_Jonas


    May 28, 2020
    I am trying to make this cube jump with bolt visual scripting. why does this not work. i only get an error message? it works if i connect the On collision enter 2d, but that makes a loop. how can i make it jump when i press space? upload_2021-5-9_13-7-26.png upload_2021-5-9_13-7-48.png
  2. Peter-Chen


    Jan 19, 2016
    You get the error message because the event is not comming from on "On Collision Stay 2D". "Collider" is an output of "On Collision Stay 2D", so if that event is not being invoked (the green arrow), "Collider" will not be available.

    I fail to find a non-event unit that returns a bool if a key is pressed. So to work around it. We need a graph variable called "Holding Space" that is set to true when "Space" is pressed, and set to false when "Space" is not pressed.

    Screen Shot 2021-05-09 at 10.35.55.png

    And then detect if "Holding Space" is pressed in "On Collision Stay 2D"
    Screen Shot 2021-05-09 at 10.35.45.png
    Last edited: May 9, 2021