Reputation: 37
Learning Roll a ball project from unity project, and pickup do not remove when player collides with them. it just go through inside them like a transparent object, here is my code.
void onTriggerEnter(Collider other)
{
if(other.gameObject.tag == "Pickup")
{
other.gameObject.SetActive(false);
}
}
Upvotes: 2
Views: 1441
Reputation: 3234
I see one, maybe two problems with case sensitivity in your code.
OnTriggerEnter
, note the capital 'O'. Unity uses a case sensitive search when it looks for methods to call.PickUp
as tag, so make sure your code matches the tag you set in the Unity Editor.Upvotes: 3