Enabling a disabled prefab in the scene

hi,

I am loading a prefab into my scene. By default this gameobject is disabled. I am stuck on enabling this gameobject from another script. Since it isn’t in the scene by default I cannot make a public gameobject and assign it. I tried getting the gameobject by name and tag but haven’t been succesful.

Anyone got any clues on this ?

Thanks

Marc

I fixed it by creating a new gameobject and setting the gameobject that I want to disable as its child. This apparantly is the only option when trying to enable it when not instantiated at start

public class AnotherScript {
public GameObject gameObjectToEnable; // assign it in inspector

   public Start() { 
      // for testing we activate it iat startup.
      // later write it where it shoule be written
      gameObjectToEnable.SetActive(true); 
   }
}

then just add some GO in you scene, attach this script to it, drag-drop your “GO from prefab” to gameObjectToEnable field and start a game.

I guess some confusing between prefab and gameobject in scene. so if this will not work - show us your project.