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.
To enable the Unity Physics Engine for a separate or empty GameObject, select the Add Component button in the Inspector window, select Physics, and specify the type of Collider.
Physics in Unity is handled by the built-in Physics Engine. The built-in Physics Engine in Unity handles the physics for gameobject interactions and the various effects like gravity, acceleration, collisions, etc.
Use the Physics settings (main menu: Edit > Project Settings, then select the Physics category) to apply global settings for 3D physics. Note: To manage global settings for 2D physics, use the Physics 2D settings instead. These settings define limits on the accuracy of the physical simulation.
The Physics Manager lets you provide global settings for 3D physics (menu: Edit > Project Settings > Physics).
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.
Starting in Unity 2019, you can use the "Unity Package Manager" to disable built-in packages altogether. Code referencing them will not compile, and they will not be included in your built application.
Unity Package Manager Documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With