(I am currently using C#)
I have a set of objects (cubes in this case) that I am loading into an array to perform all sorts of functions on.
My issue is that I want to be able to delete the cubes, replace them (instance their prefabs into the scene) wherever I want them and then continue running my functions with the new cubes.
I’ve probably overlooked a simple solution (as is commonly the case with these things).
So, what I want to know is how to have it so the scripts don’t suddenly run aground when they have no cubes to reference inside the arrays, and how to re-build the content of the arrays once the cubes have been replaced.
Can I disable a script and then restart it, re-finding the new cubes?
(just as an addition I am loading the cubes into the array using tags)
cubeArray = GameObject.FindGameObjectsWithTag (“cube”);