VERSION:
VRCSDK3-WORLD-2021.03.09.13.57_Public
-----
DESCRIPTION OF THE BUG (X):
Whenever a branched flow path is joined again, should the branch's bool have been "false", variables will be unaccessible and return NULL. Most functions, e.g. mathematical functions such as divisions, will also return NULL, even when both inputs are valid.
-----
DESCRIPTION OF THE BUG (Y):
Whenever a 2nd branch of a node references a variable that is referenced by another flow path, it will return NULL.
-----
STEPS TO REPRODUCE (how did you encounter the bug?):
X: branch a flow path, join them back together, then return any variable. You should now have returned NULL when the lower branch path is taken. (returning a new const variable without any conversion will not cause this to happen).
Y: branch a flow path, and, in the lower path, reference (and work with) any variable node that is also referenced by the upper flow path.
-----
IMAGES:
The Images below describe the refined code that causes these errors:
X (image with red letters):
When the boolean on the first branch (a) is true, everything works as intended. When it is false, the error occurs.
The test outputs below, when a is false, demonstrate the following behaviour: b still prints the correct message (new const string, unchanged), c and d return NULL. iVelocity is a variable. Inserting int velocity or int number (e) from MidiNoteOn will also return NULL.
Y (Image without red letters):
Again, the branch bool being set to false and the lower path being taken, we see that the float (here 12.5) returns NULL after the toString. This does not occur if the upper debug.log is not connected to the toString node.
-----
RELATED POSTS AND BUG REPORTS:
After searching Canny and the forums, I could find the following related reports that can be related to the bugs:
1 - https://feedback.vrchat.com/vrchat-udon-closed-alpha-bugs/p/reset-to-default-value-error (since not much information is posted here, this may be caused by the bug (X or Y) I described, especially since it appears "fairly random" to the author, just as it did to me at first.)
2 - https://ask.vrchat.com/t/why-your-time-get-time-node-is-probably-broken-and-how-to-avoid-it/2738 (While Time get Time is mentioned here, after testing, I can say that it does work, but that the error is caused by the bug I describe. You can see the author experiencing the bug Y on the lower Debug.Log node, having two Debug nodes accessing the same getTime node.)
3 - https://feedback.vrchat.com/vrchat-udon-closed-alpha-bugs/p/erroneous-variable-behavior-with-chained-for-loops (similar issues appear on other "branching" nodes, every time the non-first pin is used)
4 - https://feedback.vrchat.com/vrchat-udon-closed-alpha-bugs/p/subgraph-variables-cannot-be-referenced (Similar results to the bug (X or Y) in the old subgraph system. Maybe branches still use a system similar to the subgraph system, suggesting a fix by also implementing the SubProgram solution mentioned by Momo the Monster here?)
5 - https://ask.vrchat.com/t/jetdogs-tips-and-tricks/189/5 the statement "if you decide to use branches(if statements) you wont be able to link the next set of events." MAY have been incentivized by the error. Can not really be sure as not much information is given on why this statement is made.
-----
I am posting both bugs as one, as they are strikingly similar in nature and appear to be caused by the same problem. One fix here could potentially erase multiple bugs and solve multiple Canny posts, as shown above.