I made 2 simple objects, marked um isTrigger and the other no. I made 2 codes, where:
Trigger:
public class Gatilho : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Debug.Log("Deveria avisar");
}
void OnCollisionEnter (Collision other)
{
if (other.gameObject.CompareTag("Player"))
{
Debug.Log("Colidiu");
}
}
}
Another object movement:
public class MOve : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
transform.position = transform.position + new Vector3(0,0, -2f * Time.deltaTime);
}
}
Everything very simple AND it doesn’t work…
Below the Inspectors:
Trigger:
Another object: