Basic question about colliders and Is Trigger porpery

Hi there,

I’ve been following this tutorial

https://unity3d.com/learn/tutorials/projects/2d-ufo-tutorial

After finishing it, I wanted to learn a bit more and make PickUp being moved in random directions as game starts. So after the game starts I just apply 2d force in a random direction and pick ups are moved. As they are marked as Triggers they do not collide with 2d box colliders anymore and leave the game field after a while.

So I wanted to ask what is best practice in keeping these PickUps inside the game field? You have to keep them as Triggers as you want to pick them up by a player object, but at the same time you do need to make them colliding with borders of the game field?

How does one go around this?

Thanks

You can disable is trigger and use Layer-based Collision.

Put in the script to if the object touch the player destroy the object.

Or you can use 2 objects (one parent and one child), each one with a coliider, where one is a trigger and the other not.