Hi I'm new to unity, and I'm trying to detect a simple colllision but for some reaosn it's not tirggering:
I have two objects:
- A "Sword" which has its translation attached to the Player's translation (so it moves with him).
This has a Box Colider with IsTrigger checked,
||if it matters: this object also has an animation attached to it so that when I press space it slashes aross the screen and comes back to it's original position.|| - an "Enemy" which has a rigid body and box colider component, as well as a script with the following:
public class EnemyDie : MonoBehaviour
{
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter(Collider other)
{
Console.Write(gameObject.name + "has collided with " + other.gameObject.name);
}
}
For some reason the trigger isn't triggering and I never get the message in the console.