Detecting a spawned object

Hi all,

I need help making a script, I have a scene in which multiple random objects are spawned at the beginning of the scene.

I need to make a script that can scan the scene to check if a certain game object has been spawned.

Any help will be appreciated.

Thanks

Think I may have found an answer actually

if (GameObject.Find("WhateverItsCalled") != null)
{
    //it exists
}

Instead of constantly checking whether or not a specific object has been spawned it would certainly be more efficient to have that specific object tell the checker that it’s been spawned. Saves you an evaluation every frame, especially considering the fact that Find can get costly as your scene increases in complexity.

It’s randomly objects spawned at the beginning of the scene - no need for frame updates I think. dijital did it help what you found?

They are spawned at the beginning of the scene so the script I found works fine, I use it within the function start part of the script. Appreciate the input though.

Sure did!