using UnityEngine; using System.Collections; public class WinScript : MonoBehaviour { public GameObject win_text; // Use this for initialization void Start () { } // Update is called once per frame void Update () { } void OnTriggerEnter2D(Collider2D c) { if (c.tag == "FROG") { foreach (Object i in UnityEngine.Object.FindObjectsOfType<GameObject>()) { GameObject g = (GameObject)i; if (g.name != "Background" && g.name != "Camera") Destroy (g); } Instantiate (win_text); } } }