So I am just trying to see if when object 1 spawns in for it to check if object 2 is in the scene but by looking for a tag. If its not in the scene the delete its self.
The answer is given in the documentation in regards of GameObject. If you look in the link given;
// Search for game objects with a tag that is not used
function Start () {
var gos : GameObject[];
gos = GameObject.FindGameObjectsWithTag("fred");
if (gos.length == 0) {
Debug.Log("No game objects are tagged with fred");
}
}
The example simply create an array, and use a static function to find all objects in the scene tagged with “fred”. If found, the length of the array != 0.