Toggling setActive to Instantiate an object.

Hello,
I have a spawn object on scene that is currently disable. When the player walks into a trigger box somewhere in the scene, the spawn object is set to active, and then spawns a car gameobject. The car gameobject is a NavMeshAgent and it drives around a route of checkpoints. When the Car reaches the last checkpoint, it does a setActive() = false on the spawn.

I can the walk into the trigger box again to renable the car spawn, however it does the instantiate the car prefab the second time round.
Am I right in assuming that toggling the active state of a gameobject does not rexecute code that’s in the Start/Awake function?

Hope that makes sense

-Tareq

@Tareq_tsc_1 , you are correct that the Start or Awake functions will not run a second time. They will only run the first time. I haven’t used triggers in a while but you need to set the trigger to call a public function with the instantiate code in it. The Start or Awake functions would call this routine too.

Or you could use OnEnable, which gets called every time the object is activated.