- Home /
Question by
ryanhorbal · Jan 18, 2015 at 12:16 AM ·
c#colliderplayeritems
Player will not pick up items
I am having trouble with my code for picking up items with my player. I am thinking that it is something wrong with my actual "Player" rather than the code. I need to pick up an item when my player runs over it. I have the code exactly like it is in the tutorial but it will not work. Can someone please point me in the right direction? Thank you.
using UnityEngine;
using System.Collections;
public class PickUpItem : MonoBehaviour {
void onTriggerEnter(Collider other)
{
if (other.tag == "Player")
{
print ("Item Collected");
Destroy (gameObject);
}
}
}
Comment
Answer by getyour411 · Jan 18, 2015 at 12:16 AM
OnTriggerEnter v onTriggerEnter (capitalization important)
Your answer
![](https://koobas.hobune.stream/wayback/20220613180724im_/https://answers.unity.com/themes/thub/images/avi.jpg)