Hello,
I’m actually having troubles with a very easy task. Whenever an enemy dies, it spawns a “pick up” item; this item has the following script attached:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PowerUpBehaviour : MonoBehaviour
{
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Player"))
{
//do something
Destroy(this.gameObject);
}
}
}
So the idea is: once spawned, the item gets destroyed if the player runs over it. The player has a rigidbody and collider, while the pick up item only has a collider set as “is trigger”. Well, it doesn’t work. The pick up item doesn’t destroy. What’s wrong? Both items have colliders and at least one (the player) has a rigidbody attached. Thank you in advance.