I've setup a scene where I have two game objects (yellow vehicle and red vehicle) which when active, follow the user's finger when they drag their digit on the screen. At the moment, this is done by creating two FSMs which are setup within a touch manager game object. RedFSM enables movement for the red vehicle, YellowFSM enables movement for the yellow vehicle.
I want it configured that when the user clicks on a specific button (button 1 or button 2), the chosen vehicle becomes active and the second vehicle becomes deactivated. Each stays where they are on the screen so that they can be re-enabled.
I've created the two buttons and added the necessary uGUI proxy and the new uGUI detect touch input from Ecosystem, both of which work great.
I attempted to setup a system in that when the game starts, the FSMs are disabled (using unchecked boxes within an 'Enable FSM' stored in RedFSM and YellowFSM). When the user clicks on one of the buttons, the chosen vehicle FSM becomes active via an 'EnableFSM' located within the chosen button.
Each button contains two 'Enable FSM' actions, one aimed at the chosen vehicle to enable and one aimed at the other vehicle to effectively, disable it.
This works great initially. The game starts, both vehicles are deactivated and when a button is pressed, the chosen vehicle activates. The problem is, when the second button is selected, the new vehicle becomes active but the previous one doesn't deactivate.
I've built the above without using variables or an array and I'm starting to see obvious limitations but can't think where I'm best to put these changes in place.
If anyone has done something similar or could give me advice on how to fix the above, I'd be extremely grateful as I'm now at a junction where my game depends on this working.