Hi,
I am new to Unreal Engine and am running into an issue trying to compare some integers. I am generating a random number from an array from 0-3 and when I print out the number generated and then print the result of the compare node I am sometimes getting true when it is false and false when it is true. I attached an image of the current node structure and the output window showing the results of the comparison. To my knowledge it should only be returning true if the integer is 1 and false for every other number.
Thanks,
I don’t think it inconsistent comparison but pure node call order issue, the random node getting called twice randomizing 2 different numbers. Try using single print string with string append and display a number and compare in single callm this will ensure what truly a issue
I agree with @anonymous_user_f5a50610 - a common pitfall when coding in blueprints is not to realize the following:
- Each time a node with a white execution pin runs, then all of the other nodes plugged into it run, whether they just ran for the previous node or not.
- If you want the same random number as the last time, you need to save it to a variable and refer to that variable instead of running a wire back to the random number function node. Otherwise you will run it AGAIN and get a different number.