Working on creating an item that I am able to collect in my level. Right now, I have my item laid out in the level, I have a box collider on a cube with no mesh rendering to trigger a point light that will highlight the item when the player is within range of the item. I created an item script that will make a noise, display some text, and delete the prefab object once the item is collected, but when I walk into the item, none of that happens. The point light highlights the item, but I do not collect it, nor does it make a noise.
I took a picture of my script so maybe someone could see where I am wrong?
Replies
I triple checked this when I first ran into the error to make sure that I had that set.
I can provide more pictures of the whole thing if you need them!
Destroy (gameObject);
Doing this, however, may cut your audio short. So you'll need to delay the destroy until the audio is finished playing.
There we go!
Thank you for the help by the way, I really appreciate it!
Also try shutting down Unity and restarting. It's really weird that you don't have any errors and still not able to interact with the item at all.
I had no idea that other colliders can interfere with that if they aren't in said object.