I have a state machine and want to randomly select between 2 states.
So from one state I want to drag two lines away, one to option 1 and another one to option 2. They both share the same condition, which is already bad design because if I want to change this condition I would have to edit both. But now how to randomly select between these two? My first thought was to have a variable like “RandomBool” which get’s set in the state before, but then I noticed I can’t set variables in states…
I also tried to select from 2 animations randomly in one state, which I also have not get working. Because they all should loop and there is no way to see when one animation finished (inside of one state) there is no way to select between 2 animations in one state, so I had to create 2 states which call each other in a loop like this:
But this is also bad design because the lines going away from them to the next state are having the same condition, but if I would want to change it I would have to edit it manually in both transition rules. If I would have 5 animations which should loop randomly I would have 5 same transition rules going to the next “real” state which I would have to edit manually - and I would need to have 5*(5-1)=20 internal transition rules between these states which would just all be “Animation time remaining == 0”. For 10 animations it would already be 90 transitions between the states to let every animation be playable after any other of the 10.
I think this is not really how it’s supposed to be used, so I’m probably doing something wrong