• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by chillypacman · Mar 25, 2014 at 07:34 AM · editorperformanceprofiler

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...

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Benproductions1 · Mar 25, 2014 at 09:15 AM 0
Share

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?

avatar image chillypacman · Mar 25, 2014 at 10:02 AM 0
Share

Yes, it made a huge difference to performance...

1 Reply

· Add your reply
  • Sort: 
avatar image
0

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...

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Benproductions1 · Apr 04, 2014 at 11:13 AM 0
Share

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.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Low FPS in editor but normal on iOS or Android build. 3 Answers

Bad Performance in Unity? 1 Answer

Editor incredibly slow, weird profiler output. 1 Answer

Unaccounted time between: WaitForTargetFPS and GPUProfiler.EndQueries 0 Answers

Is there a way to check the performance in edit-mode? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges