Hello.
As the question say, I need to add force to a prefabs that are spawned from an array, and they need to be added to the prefab one at a time.
Let's say there's an array of 10 prefabs that are spawned and moving around. The next time the user clicks on the mouse, AddForce should be added to element 0 in the array, then the next time the mouse button is clicked AddForce should be added to element 1 in the array, so on and so forth. This should go all they way through until the end of the array.
What's a good way to go about doing this?
I initially thought that just adding a public bool and flipping that when the mouse button is clicked, but of course this makes it so all elements in the array are affected by the AddForce.
How can I do it so only one prefab is affected on at a time?
Thanks!
↧