Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 goshdarngames · Jan 03, 2015 at 06:04 PM · editorperformance

Game runs fine first time but lags when stopped and started in editor.

I am having a problem when running my game in the Unity Editor. The first time I run my game it will perform as expected. When I stop and start the game using the 'play' button within the Unity Editor it will run extremely slowly. If I close the Unity application using the 'X' window button and restart the application the game will again run OK the first time and then lag if restarted using the 'play' button.

I am working on optimizing the performance of my enemy objects. To test their performance I spawn 50 enemies one at a time with 0.5 seconds in between each spawn.

The first time I run the game it will gradually slow down to 30-40 FPS* as the 50 enemies are added. Once all the enemies are added the frame rate will stay stable.

The second time I run the game (after stopping and starting with the 'play' button) the game will very quickly begin to lag as enemies are added. When it reaches 25 enemies the frame rate will be <1 FPS.

If I exit the Unity application in Windows and start it again then the game will run fine again the first time and lag when restarted.

There are no errors or warnings in the console.

My game makes use of the DontDestroyOnLoad() method in order to create a static enemy pool. Enemies are created in the first scene of the game and re-used rather than created and destroyed. I used the 'Persistent Singleton' pattern for this pool, which is described here: http://unitypatterns.com/singletons/

I have posted this problem on Reddit and tried some troubleshooting already. You can read the thread here for more information: http://www.reddit.com/r/Unity3D/comments/2q6o2b/poor_performance_after_restarting_game_in_editor/

The problem has occurred in both Unity 4.5 and 4.6. I have tested the project on another computer and encountered the same problem. I don't have any third party editor plug-ins or scripts.

I suspect some data is persisting between runs in the editor. Does anyone know of anything that could cause this behaviour?

  • I don't know if it's relevant but sometimes it will slow to 30 FPS and sometimes (on different days) it will only slow to 50 FPS with no known change in background applications running.

Comment
Add comment · Show 1
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 SpaceManDan · Apr 26, 2016 at 08:35 AM 0
Share

I wish somebody would have answered you on this. I have this same issue.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by YoungDeveloper · Apr 26, 2016 at 08:51 AM

I've had similar problems with unity editor performance. The bottleneck was the running profiler. Or i should say the reason was poor development machine.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

FPS decreases over time in editor (Potential memory leak?) 2 Answers

Why does asset import take so long? 0 Answers

Efficient sprite sheet animation with Editor preview 0 Answers

Is OnDrawGizmos called in build? 2 Answers

Intense CPU usage when running networking code on Editor only 0 Answers


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