unit – Rigidbody & Ray alternative or optimization

I create a HAVE which moves at certain points, but should interact with any objects seen.

the have should find others have communicate or search objects on the ground.

It works with all these solutions with a small number. But when I have +300, the fps drop a lot, caused by Physics2D.FixedUpdate or something related to physics.

How would you treat that?

I have tried these solutions:


Solution 1

HAVE:

  • Rigid2D kinematics
  • SphereCollider2D Trigger
  • OnTriggerEnter & Exit Script.

Objects

  • Rigid2D kinematics
  • SphereCollider2D Trigger

Solution 2

HAVE:

  • Rigid2D kinematics
  • SphereCollider2D Trigger
  • The OnTriggerStay script executed every 120 images and a Coroutine to simulate OnTriggerExit.

Objects

  • Rigid2D kinematics
  • SphereCollider2D Trigger

Solution 3

HAVE:

  • No rigid body
  • SphereCollider2D Trigger
  • Cone of Rays executed every 2 seconds to detect colliders on certain layers.

Objects

  • No rigid body
  • SphereCollider2D Trigger