How to disable physics system in unity

Muhammad Ameen picture Muhammad Ameen · Sep 6, 2017 · Viewed 8.4k times · Source

I want to develop native android app in unity engine, and does not need to use physics, could it possible to disable physics engine for specific project in unity.

Answer

Programmer picture Programmer · Sep 6, 2017

How to disable physics system in unity

This was not possible in the past but is now possible if you have Unity 2017 and above.

Disable Physics Simulation:

Physics.autoSimulation = false;

Enable Physics Simulation

Physics.autoSimulation = true;

For 2D, use Physics2D.autoSimulation.

Once you do that, make sure you don't have FixedUpdate() function in any of your script. The physics will not be simulating. I would also set the fixed timestep to be small as possible.

Actually I want the settings like when my app start in device it should not load whole physics classes

No, you can't do this one. Forget about it. If your app is loading very slow, you need to look somewhere else as the problem not the Physics API. One example is the using the Resources folder. This is very slow. Also, you should simplify your main scene with just UI to make it load faster then use LoadAsyncScene to load the rest of the scenes. Make sure to disable audio decompressing on load. You can Google "Unity optimize load time" for more information on this.