My trigger does not detect my player.
My Trigger.cs file:
using UnityEngine;
public class Trigger : MonoBehaviour {
public Camera camera1;
public Camera camera2;
public GameObject panel;
void OnTriggerEnter(Collider other)
{
camera1.enabled = false;
camera2.enabled = true;
panel.SetActive(true);
Debug.Log ("Entered-");
}
void OnTriggerExit(Collider other)
{
camera2.enabled = false;
camera1.enabled = true;
panel.SetActive(false);
}
private void Update()
{
if(Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.S))
{
panel.SetActive(false);
}
}
}
Where I can start troubleshooting te issue?
Object on which the trigger script is sitting on.
The solution:
-- I created two colliders, and assigned one as a collider, the other (bigger) is a trigger.
-- I also had problems with the small triggers in the scene. The triggers were to small to be detected by my main player, althought
they detected my "sphere" player object