Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 fiction_talker · Jul 26, 2011 at 04:24 AM · c#editor-scriptingdebugvisualstudiorelease

Editor Script and Visual Studio Release Configuration ?

I currently have an editor script that procedurally generates a texture. The majority of the code is math that has no dependencies on UnityEngine, it only uses UnityEngine for the last steps of writing raw data into a texture. When I run this code inside of Unity it takes the same amount of time regardless of what I set for Debug/Release inside of Visual Studio. The time it takes to run is equivalent to the terminal version "Debug" build running with debugging on. Obviously this is much slower than when I create a "Release" build running with debugging off.

Does Unity make use of the selected Solution Configuration from Visual Studio ? What can I do to get my code to run at performance levels equal to a "Release" build version of the code without debugging while inside the editor ?

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by fiction_talker · Jul 29, 2011 at 02:43 AM

I built a .net dll of the math code and linked it into the project. Unfortunately this saw no difference in performance. The code itself is just computing a noise function for a 1024x1024 array. Here are some relative numbers for what is going on.

Running the code inside the editor: 96ms

Building the game and running the code there: 65ms

I get consistent timings regardless of whether I am using the externally built library or I compile the code directly in my project. These are the timings I get outside of unity. Just to clarify the following performance numbers were done in VS with both debug and release builds. The actual code in question is not heavily effected by the the optimize flag so whether the debugger is attached or not is the only real difference.

Running the code in VS with debugging: 74ms

Running the code in VS without debugging: 44ms

I did some further testing and installed a separate mono runtime. By using mono develop I can execute the code on mono or .net. Running on mono independent of unity results in performance numbers that match those I see in unity. I guess it is rather obvious now that I think of it, in unity the code is being executed using mono while in VS and standalone it is being executed using .net. This is the cause of the performance difference. I still find the difference in performance between mono and .net rather surprising since this code is straight forward number crunching.

Comment
Add comment · 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
0

Answer by Statement · Jul 28, 2011 at 05:07 PM

Does Unity make use of the selected Solution Configuration from Visual Studio ?

No. Not unless you build a separate dll to use within Unity. Unity compile your scripts each time they are saved. Note that running the game (and thus any scripts) through the editor is slower than running a built game. Unity scripts also runs a bit slower than code compiled with Visual Studio when I wrote a few tests some year ago.


I suggest you try build a .net dll of your math code and include it in your project that way, to see if there is any perfomance gains. Please also reply back in a comment when you've done so to draw any conclusions wether or not this helped.

Comment
Add comment · 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

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.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Unable to step. Operation is not supported 0 Answers

Impossible to use Visual Studio 2015 Debugger anymore (Unity 5.2.1f) 2 Answers

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Editor Script into .dll(Solved) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges