๐งน Organization
Remember, the main purpose we use State Machines to begin with is so we can break down a complex system into smaller and simpler systems! So organization is key. I will be showing how I personally like to organize my State Machines. Obviously you can do it however you please yet I'd still highly recommend you to do it this way!
First Create 2 foldersโ
We will be using 1 folder to group the states and the second one to group the transitions! Now let's start by making 2 states and 2 transitions.
Create 2 ModuleScripts in each folder as the following exampleโ
In this example we will be creating a state machine that manages the color of a part! it will have 2 states: a red and a blue colour. So we want two states: Blue and Red. We also want to make 2 transitions that will allow us to go from blue to red and from red to blue!
Create a Part and call it "myPart"โ
We will be creating a part in the workspace and use it as an example to how we can make/use the StateMachine