Deactivate/activate objects depending on player position

I’m creating a big VR environment with a lot of objects in the scene, and my phone is not able to handle them.
I think it would be great to control the activation/deactivation of the objects with a script, depending on the player x position: i.e. when x is < 20 deactivate the firsts 15 objects in the scene, and recreate them when x is > 20. How should I do?

What is the function you want?

Did you try using occlusion culling?

This is a guide on setting up occlusion Culling, this will improve proformance, using batching / color atlases, checking recommended quality settings for mobile and using audio correctly can greatly improve proformance on mobiles.