I have a Carte ion the scene :
The Carte have a box collider :
And I have a Player the Player have some components : Also Animaitor , Rigidbody
And the script that attached to the Player :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UnlockCrate : MonoBehaviour
{
public GameObject player;
private void OnTriggerEnter(Collider other)
{
if(other.name.Contains("Crate"))
{
Debug.Log("Hit !");
}
}
}
First the script was attached to the Carte but then I moved it to the Player.
In any case the trigger is not working , it does working if for example I set on the Player the Capsule Collider Is Trigger to true but then the Player is falling down or walk through objects and if I set the TRigidbody Is Kinematic to true then the Player will not move it will walk on the place.
The main goal is when the Player is getting close enough to the Carte then play animation. but the trigger part is not working.

