Question by
putback · Oct 05, 2015 at 01:56 AM ·
ui2d gamemobile2d-platformermobileoptimization
How to have UI Manager come up on collision?
Hello, I am creating a collision game and I want to bring the game menu when I'm done. Even though my code seems right, when the object collides the menu doesn't come up. I will award best answer using UnityEngine; using System.Collections;
public class EnemyDestroyer : MonoBehaviour {
public UIManager ui;
// Use this for initialization
void Start () {
ui = GetComponent<UIManager> ();
}
// Update is called once per frame
void Update () {
}
void OnCollisionEnter2D(Collision2D col){
if (col.gameObject.tag == "EnemyCar") {
Destroy (col.gameObject);
ui.gameOverActivated();
}
}
}
Comment