Don't update gameObjects too away from player.

So lets say my game project will have a very heavy amount of GameObjects for whatever reason. Dunno, 50000.

Each object has the next components: RigidBody, Mesh Renderer, Box Collider, and a simple script.

Considering the amount of objects, it makes sense to only "work" on the objects that are close to the player, in X range.

So my first idea was to use Vector3.Distance to check the distance from this gameObject to the player's transform (this guy is a first person controller). However I decided not to do so because I though that calling Vector3.Distance 50000 times per frame was just too much. Also because I have this other issue where for some reason the position of the player is not updating:

So, what's your idea?

When I figure out a good way to make my objects only "work" when they are close to the player, I will need to know.. how to stop the "work" thing lol. I guess disabling the components is a good start?

Use a grid. Every object updates which grid cell they're on during their last updates. Then you only need to 'activate' those grid cells which are of interest. I'd go for a grid size about 2/3 of your lod range.