- Home /
Disable 2D Phsysics
Is there any way to disable this?
What do you mean? You want to temporarily? If you don't want physics on an object entirely, then just remove the rigidbody and leave the collider. If you want to temporarily, then set rigidbody2D.is$$anonymous$$inematic to true.
Completely, I have no 2D physics in my game so why waste time initialising it ?
It's not going to be initialized unless you have 2D physics objects in the scene. You game gets compiled with what it requires, it's not going to be doing extra processing work just because it supports some 2D physics functions.
When I profile my game I'm getting fractions of ms spent on Physics2D functions, the same as if I were to not use physics in my game Physics and Physics 2D will always be initialized and be trying to call functions from every script. Yeah it's producing nothing but it's still CPU wastage
The Physics2D calculations are the collider2D info calculations, they are tied into the Physics2D system. If you start a fresh scene with nothing in it, you'll see that Physics2D is not running. It's running in your scene because it's doing something related to it.
You're trying to micro-optimize at way to small of a level. Get your game working, then optimize afterwards if needed, not the other way around.
Answer by puppeteer · Aug 03, 2015 at 09:31 AM
Did you try to go into Physics2DSettings and setting all fields there to the minimum? For example set Velocity Iterations to 1 or 0, which should make it less heavy on the system.
Answer by Johannski · Feb 05, 2017 at 10:56 AM
I can confirm that still (Unity 5.5.1p1) the profiler does show activity in physics2D in an empty project, even if the camera is not active. Not quite sure what is going on there, but I guess it won't have a huge performance implication.
Your answer
Follow this Question
Related Questions
Moving static colliders in Unity 2D 1 Answer
(2D) Creating a border around the game 4 Answers
Unity 2D: sprite's rigidbody weight/rotation 0 Answers