Hello, i have looked all around the internet looking for answers, but i am a beggininer and dont understand some of the stuff. Could someone help me with some code to detect a simple collision between my character and the environment. If the character collides with the environment then i need my “Loose” menu to pop down, which i already have animations for. I am also going to have the script attached to a manager component i have already
So basically:
If character collides with environment
Loose menu pops down
Thanks, here is some code i have done already:
using UnityEngine;
using System.Collections;
public class IfLoose : MonoBehaviour {
bool AudioListener.pause;
public GameObject looseMenuPanel;
private Animator anim;
void Start () {
Time.timeScale = 1;
anim = looseMenuPanel.GetComponent<Animator>();
anim.enabled = false;
}
public void OnCollisionEnter(Collision collision){
}
public void Update () {
}
public void PauseGame(){
anim.enabled = true;
anim.Play("PauseMenu");
Time.timeScale = 0;
AudioListener.pause = true;
}
}