GameObject.FindGameObjectsWithTag still finding destroyed object (C#)

I have a few methods that perform some tasks. Some are stored publicly on my “Manager” that always exists. My levels have a “Level_Manager” that call them as needed.

When I try the following I get incorrect results.

character_spawn_manager_inst.DestroyLevel ();  //first level has 1 spawn
character_spawn_manager_inst.LoadLevel ();  //new level has 4 spawns
character_spawn_manager_inst.SpawnFinder();  

result: 5 spawns?

Here is the main code of SpawnFinder:

spawnPoints = new GameObject[GameObject.FindGameObjectsWithTag ("Spawn_Point").Length];
spawnPoints = GameObject.FindGameObjectsWithTag ("Spawn_Point");

Why is GameObject.FindGameObjectsWithTag still finding the recently destroyed objects?
I’m guessing the reasoning is something simple that I’m just not seeing. Any input would be great. Thanks!

As @AlwaysSunny pointed out, your array initialization is way off. Actually, what you’re doing is first making a new array with the length of the array returned by the FindGameObjectsWithTag method, and then immediately discarding that array in favor of the one returned by the array.

So, I assume you’re doing an Application.LoadLevel somewhere in the LoadLevel method. In that case, all of the gameObjects in the current scene should be destroyed. But, unity destruction is kinda wonky at times, and objects can be around on the same frame as you’re destroying them. If you’re using LoadLevelAsync, then the behavior you’re seeing should be expected.

What I’d do to solve this, is to move the call to the SpawnFinder method to OnLevelWasLoaded. That should make sure that all of the old objects are gone before the call to the method.