'Else' 'And', and, 'Or' statements

So, I’m working on a horror puzzle world where you must arrange objects in a certain order to continue.
I figure I can just use triggers for this. Which is fine.
But, how I have it planned is that, the objects form a word. Think letter blocks that babies play with.

My issue is that the word I’m spelling has letters that are doubles.

This is why I was wondering if ‘Else’, ‘And’, ‘Or’ statements were a thing in Udon.

Also, I was wondering if there was a simpler way to do this with String variables. Initially I had planned to use integers and have the objects raise the value when they are touching but I’m not sure.

Most things you can do in c# can be done with udon.

However with something more complex like this I would honestly suggest you use U# (udon sharp) since it’ll be easier to maintain long term.

But yes, if and else are supported. as well as && (and) and || (or) statements

Alrighty. Thanks.

While Udonsharp will be more familiar to people who already program in C#, basic boolean logic does not require Udonsharp. You can find the nodes you want in the boolean section, and they’re called “conditionalAnd” and “ConditionalOr”. You can chain them together and plug them into a branch, or plug branches into branches to do “if-else” logic.

Heh, I think a lot of people get frustrated when someone askes “How do I do this in Udon Graph?” and you get a response back “Do it in udon sharp.” I don’t think its helpful, and it doesn’t answer he users question. I’m personally trying to learn both methods. So here is a useful answer. Yes! In Udon Graph the if statement is the “Branch” constructor under the menu Special > Branch.

Branch

You will find all of the operators under the specific variable type: int, float, boolean etc… These are located in the System section.

Int

Equality and Equals is hidden in a sub menu, I don’t know why, but look under “other” at the very bottom of each menu.

1 Like

It’s also worth noting that you can type in the variable type into the search bar, select the type, and type “equality”, “equals” etc. and find the operator node that way. Avoids having to navigate the menus just to find one node;
image
image