I want to get a list of GameObjects that contain this script named
I then destroy that script on all those Game Objects, but want to keep the list with the Game Objects.
I do it now by Having a list of
Alpha aList = GetComponentsInChildren<Alpha>(); // Destroy scripts here. foreach(Alpha a in aList) Destroy(a);
If I didn’t destroy the scripts I know I could do
However I do have to Destroy these scripts then I want to keep pointing to the GameObject. I tried things like this but failed to compile.
GameObject list; list = GetComponentsInChildren<Alpha>() as GameObject;
I would rather not have to search through the components twice nor would I like to copy the array before destroying.