Udon Graph If statement

Udon Graph If statement example

Unity: 2019.4.30f1
VRchat: VRCSDK3-WORLD-2021.09.03.09.25

I’ve noticed the available guides are not really tailored to getting started with standard programming syntax for Udon Graph. It took me a while to dig around and find out how to put together something as simple as an If statement. So I want to share my knowledge with Udon Graph beginners.

In Udon Graph the If statement is called “Branch”. It can be found in the Special submenu.

Branch

That’s the easy part. The conditional expressions can be found under each variable type. (Example: boolean, int, float, string, etc.) These can be found in the System submenu. You can use the search menu to quickly find these types. Equality and Equals is found in the additional “Other” submenu under each variable type.

Here is an example for two boolean variables being evaluated with the following condition:

if ((A)&&(B)) {
    Debug.Log ("Bool If True");
} 
else {
    Debug.Log ("Bool If False");
}

I’ve included more examples in the Udon Graph code snip below:

Udon Graph Code:

application/vnd.unity.graphview.elements AOVc224cxxH9FWKf2YPqrq7qbiF6iC8yhBhJAMt6sQWirxJjelchl04EWV+Wh3xSfiE1eyGXu0N7bJHiLg0JC+yFM91VdapOXXr+95//vp/8FM8u6+TJd+8n7fLs7K/xR3kzeRnPT2M6qyffvLuY1x8/m83OapxOjieXp0W+ZgQG5qS011bZ3LJKLYAqxL6hb8nYIj9+O7s4nZ/OppMn7yf/njxRBgA7Y4C8BrLsHR1P3snnWkPotA7orWNiQx+OJ9NZqd8+/+JCVjaRS13/f3U8aWezf62+e7X85ct+ExeLXVxOT+fv/pb+UfP85XJr7yen04t5nOb6/IvJE5CLX8zPT6evV19PlnvsVps8PvrxIs/Oz07T8dHLen4h639qO+j/HR99fnk2vzyvT6f1cn4ez46P/n6Zzk7zX+q7F7Mf6vRpci5SJpa92Ao+/PziXG7x4fgjlvXN4sN9W9W9COtZPLt4pOu6Dy1OZ1NZ1at+XeOhW5N2WWtUueqsbNSkfMaqdNK2ZdJYLB8OdPdPKY/Yhvd1XQ+GrefTOZorZEGz1jRdVU2+KetyUhG1VqGU0KwhFPgMIstSp8EBEbMFgdAKWc5jhyEweQOoHygoLrZ4t6LF/dO27PLFm/P6SPGxr+t6MNx+I7c9q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