- Home /
Unity Profiler slows Unity to a crawl (basically crashes) when using square root functions
I have a few square root functions I have to use (.magnitude) and this basically stops Unity in its tracks when the profiler is on.
Anyway to prevent this from happening?
I've treid setting profiler.enabled = false before the maths then re-enable it but to no avail...
Are you sure it's the sqrt
function in the magnitude
property? Have you tried just replacing magnitude
with sqrmagnitude
to see if it makes a difference?
Answer by haim96 · Mar 25, 2014 at 10:17 AM
http://docs.unity3d.com/Documentation/ScriptReference/Vector3-sqrMagnitude.html
sqrMagnitude should do the job with less performance impact according to that...
In many cases that isn't an option, but none the less a couple sqrt calls should not have much of an impact on performance.