Magnet PowerUp [Endless Run]

Hy every body in your opinion wich one is the fastest method to make a magnet power up without making lag in an endless run game??

I thought 2 thinks:

  1. make a for cycle for any coin gamobject, and when they are in range, they learp to player position.
    2)make a script and attach to the coin gameobject, that check if player got the power up and is in rage, if true learp his position to player

Other solution to prevent lag

How about adding a trigger to your player, and add a Monobehaviour to your player that contains a OnTriggerEnter function, check if the collider that entered the trigger is a coin (either by tag, or search for a component) and let it lerp towards the player if it is. Make sure to also add a collider to the coin object (also, on another layer that doesn’t collide with the player itself). For a magnet powerup, just increase the trigger size.

I Like the idea about increse the trigger size ty…

Yes, I would use a trigger. In theory, you could just expand your player trigger. So, whatever method you normally use still rings true and can be used as the way to collect the coins. No need to add in any new behaviors beyond adding some new sprite to show the magnet is active and expand the triggers size.