using UnityEngine; using System.Collections; public class CubeStyle : MonoBehaviour { public int Style; public GameObject lifeCube; public GameObject speedCube; public GameObject bombCube; // Use this for initialization void Start () { } // Update is called once per frame void Update () { } public void OnTriggerEnter(Collider other){ if (other.CompareTag ("Explosion")) { if (Style == 1) { Destroy (gameObject); Instantiate (lifeCube, transform.position, transform.rotation); Debug.Log ("2"); } if (Style == 2) { Destroy (gameObject); Instantiate (speedCube, transform.position, transform.rotation); } if (Style == 3) { Destroy (gameObject); Instantiate (bombCube, transform.position, transform.rotation); } } } }