You know how Little Big Planet, Kingdom Hearts and similar have various pickups move towards your character when you get up close? Yea I also find that’s a nice bit of polish.
One way of getting that up and running in Unity is via the code below. Setup:
- Add all objects you want to get attracted to the player to a special layer.
- Attach the script below to your player.
- Set the layer mask on the component to include the layer from step one.
- Tweak, play, repeat.