Bolts equivalent to IF statement in nodes?

William ianneci 2 years ago updated by Reality.Stop() 2 years ago 9

I am pretty sure I know the answer but wanted to confirm. Bolts equivalent to the IF statement would be the branching nodes?


void Update() {
   if (Input.GetMouseButtonDown(0)) {
   RaycastHit hit;

What would/should the equivalent be for if? Or is it inherent in the actual node like OnMouseDown as an example.

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):
Satisfaction mark by William ianneci 2 years ago

On Mouse Down is an event in BOLT, which is nice because you don't need to tie it to Update, and can use it to make easy transitions, but what you are looking for is under the "Control" group in the menu, specifically  the item named "Branch" which will take a bool and route your script one way if true, the other if false.

Heres an example script that will check every frame for the equivalent of

if (transform.position.x >= 5)

Ha. Not sure why I even asked as I already knew the answer. Every  time I use a visual coding asset the 1st thing I do is convert some of my own code and of course I'm looking at the code and there is never a directly worded equivalent for things like if. Ha. I know that and knew it was the branch nodes. Just needed a conformation reminder ha. Thanks. 

No problemo!  I have those moments more often than not ;)

Yep. I think we all do.

Yes, the direct equivalent to if is indeed Branch.

I thought so, NeedLoomis was kind enough to help me kick myself in the head to remember it. HA.

Noob here, what do I use for "else if"?

Put another branch and wire it's control flow in to the "False" output node of the first.  That way it will only evaluate the second if the first branch was "else"