i have an object laying on the ground and it has a tigger so its constantly getting collisions triggers from the terrain collider
so i have this code which works fine
public class ArrowPickupTrigger : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
if (!other.gameObject.CompareTag("Player"))
return;
GameObject UI = GameObject.Find("UI");
GameObject pickUpText = Helpers.FindObject(UI, "PickUpText");
pickUpText.SetActive(true);
// Debug.Log("ArrowPickupTrigger OnTriggerEnter");
}
my worry is that its inefficient. i have a feeling that layers are designed to make this more efficient but don’t know how. can someone please advise? thanks
But you could make a child object with the trigger on the child object. Then in layers make the child object only interact with the Player in the Physics matrix.