Hello, I have a question about performance. My game is going to have many objects in the scene. I have made a script but I m not sure if the way I did is the best one. In the script I wrote in LateUpdate check player position if player comes near 20f, set active mesh renderer of this object. If the player. position is more than 30f disable mesh renderer.
the thing is I m going to have like 200 or more object in the scene and every single object is going to have this script attached would that be bad for performance ?

Sounds like you are doing some LOD on those models in your scene so its not drawing too many of them.
UNity has a built-in system for handling LOD, you can use that if you like…
see here… Unity - Manual: Level of Detail (LOD) for meshes

another alternative is to have a manager… with a list of all our objects to check ranges.
Then just have that one manager script run through loop of all the checks at the same time in a loop. which should be faster (and avoid the issue of objects turning themselves off when far, then not being able to turn themselves back on when close. (because they are off, and code isn’t running))