I start out by creating a number of prefab clones via a standard script in an array, I then have a FSM that is located on the prefab that waits for a touch event. On touch, screenpick, we check our global variable touch counter, if 1 then save the game object into another global variable and kick off a create game object function (particle effect). If 2, save hit item as current item (vector 3 position), then create a particle effect both on the old position and the new position and clear the counter global variable.
If I debug the flow from 1 I see that 9 objects are created, not one? Not sure why, thought it might be related to the array of prefabs but on changing the number of prefabs created the same (9) objects are created.
Please help, I'm a noob.
--- Update ---
I recreated a new prefab, attached the FSM to it and changed from a touch based initialise to a mouse-up. It looks like I have a logic problem here, I do a mouse-pick and a bool-set to true if it succeeds. I save the game object that it hits. I then do a bool-test and if true kick off the create particle effect section. The effect of this is that the particle effect is then kicked off n times (number of items in array) which tells me that I need to not use a bool-test on prefabs because they will all, always be set to the same. So, my logic tells me to use the mouse-pick-event and then try and save the game-object info... what's the best way to do this? get FSM game object, drop to global variable?
--- Update 2 ---
Got it working with the following: First mouse pick, then mouse pick event and drive successful event through to another state that creates the object. No global/local variables.
Problem I have now is to convert this scenario to a touchscreen one with prefabs, there is no screen pick event function that would allow me to duplicate this logic? How else could I accomplish this?