SetActive(true); not working

Hi, I used this code to disable the child Star from the Parent Galaxy, but when I want to visit this star, I am unable to enable it.
I have 10 Galaxy folders, each have 9 star folders, each star has 9 Planet folders, and each has 9 Satellite folders. If I don’t disable each Star folder when I don’t need them I will have a maximum of 7290 visible objects, slowing down the program.

The code I use to disable and also works is; p = 0 to 9

starFolder= GameObject.Find("Galaxies" + p + "/Stars");
if (starFolder) starFolder.SetActive(false);

The code I use to enable and does not work is; p = 0 to 9

starFolder= GameObject.Find("Galaxies" + p + "/Stars");
if (starFolder) starFolder.SetActive(true);

I can render the Mesh to false, but too much work for 7290 objects. Easier letting the folder Star and its children be disabled.

GameObject.Find - “This function only returns active gameobjects.”

Couldn’t you tag all your stars e.g. “stars”, and then use

GameObject[] starFolders = GameObject.FindGameObjectsWithTag("stars")

to store them in an array at game start?

No idea how the order of the list is determined but if that can be controlled somehow, you could use the index to access the folder you need.

I believe the issue is that some of the game objects are not loaded at the start up. I get around this issue by creating a startup function that fires on the first update.

    bool startUp = false;
    
    
    Update() {
    
      if (!statUp) onStartUP();
    
    
    }

    void onStartUp() {
      someObject.SetActive(true);
      startUp = true;
    }

It do not work because the objects is not Active