If GameObject with tags not on scene

I have coins object on scene. They have tags: ,,Coin". (These are prefab) I will make this: if all ,,Coin" tagged object destroyed on scene, then activate Level2.

How can I make this?

#Unity-4-3

I have this code in a simple GameObject on scene, but does not work.
If play scene, all tagged "Coin" in scene, but the Level2 activated…

if ( GameObject.FindWithTag("Coin") !=null)
{
    Application.LoadLevel ("Level2");
}

This does not work too:

if ( GameObject.FindGameObjectsWithTag("Coin") !=null)
{
    Application.LoadLevel ("Level2");
}

Try this:

if ( GameObject.FindGameObjectsWithTag("Coin").Length == 0)
{
    Application.LoadLevel ("Level2");
}

You cannot use a null check because FindGameOjectsWithTag() always returns an array. It just will be empty if it does not find anything.

Or alternately you can do:

if ( GameObject.FindWithTag("Coin") == null)
{
    Application.LoadLevel ("Level2");
}

FindWithTag() returns the first one found, so null check will work here.

Here is my solution to this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class DestroyEnemyTags : MonoBehaviour
{
    [SerializeField] UnityEvent myEvent;
    [SerializeField] string myTag;
    void FixedUpdate ()
    {
        if( GameObject.FindWithTag(myTag)==null )
        {
            myEvent.Invoke();
            enabled = false;
        }
    }
}