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 /
  • Help Room /
avatar image
0
Question by SmashedBug · Dec 03, 2015 at 04:19 PM · editorfreezing

Unity freezing without any while loops, only in editor

Hey everyone, so the project I am working on is rather new, but we encountered a recent problem.

Typically, 1-20 seconds into the project, it freezes completely as if I had an infinite loop. I cannot pause the game, it will not react to anything I touch, and I have to end the process to try again.

I have no code that even touches a while loop, or any non-determined loop for that matter.

I tried debugging with MonoDevelop debugger, but it says it could not connect.

One last strange thing is... It does not crash when I build and run the project. It runs completely fine, with no issues whatsoever. It only persists in the editor.

And sometimes, every once in a while, it ends up closing after it freezes and asks me to submit a bug report, but that rarely happens.

Any pointers or suggestions?

Comment
Add comment · Show 5
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 meat5000 ♦ · Dec 03, 2015 at 05:38 PM 1
Share

Read the editor log/ crash log and look for the errors in there. Go from the bottom up.

If you instantiate anything, look for cases where its instantiating too much, or any branching-out behaviour, where an object generates more than one more object, which in turn each spawn more than one object.

Expensive coroutines improperly yielded will halt the main thread, WWW class can halt the whole program. There's lots of things it could be.

avatar image SmashedBug meat5000 ♦ · Dec 03, 2015 at 06:58 PM 0
Share

@meat5000, editor log shows nothing, it outputs nothing.

I am dealing with instancing something most of the time, but I feel like it has also happened without instancing an object. However it is just particles, so those particles would not instance anything else themselves.

Can Unity crash if you just instance a LOT of things at once? Not like thousands of gameobjects a second, but like 100-200 every second?

avatar image meat5000 ♦ SmashedBug · Dec 04, 2015 at 08:56 AM 1
Share

Yes thats a lot of objects to spawn in such a short space of time. Of course it does depend on the objects and what is on them. Are you sure you read the editor log, not the Console log? Its very rare that theres nothing in it at all.

$$anonymous$$ake sure to select Attach Debugger option in Prefs to help $$anonymous$$ono connect.

Id be happy to take a look for you if you want to dropbox your project. This sounds like something that will be tricky to track down otherwise.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by SmashedBug · Dec 28, 2015 at 09:37 PM

I figured out the solution, it was due to some faulty code, but it still confuses me when I look back at it.

Basically, we have a mouse controller which uses an external DLL to control input for up to 4 mice. Inside of that, we determine the chance in mouse position, and move a reticle (now obsolete) to point towards where the player wants to aim.

This chunk of code was used to rotate a center body that would be holding any weapons or items the player picked up, to show how they are aiming it or moving as their view shifts. I can't properly comment it, as the coder who wrote it did not discuss it that much with me.

 center.LookAt(reticle.transform.position);
 Vector3 rotation = new Vector3(0, 0, -center.localEulerAngles.x);
 center.transform.localEulerAngles = rotation;
 if(reticle.transform.position.x < player.transform.position.x) {
        center.transform.localEulerAngles += new Vector3(0, 180, 0);
 }

So this code would be called at most 4 times every update function. I figured that rewriting the code without the LookAt() function would be best, since that is intended for 3D and our game is 2D.

 firingVector = reticle.transform.position - center.position;
 firingVector.Normalize(); //normalized for later use
 float rotZ = Mathf.Atan2(firingVector.y, firingVector.x) * Mathf.Rad2Deg; //moving the rotation of the center here
 center.rotation = Quaternion.Euler(0, 0, rotZ);

It still confuses me, because replacing this code inside each individual player would fix it. What is even more confusing is that this isn't always 100% reproducible, since it could freeze from 0-30 seconds of using an item, and picking it up (setting it as the child of the center). So if anyone is stumbling across this and has any input or ideas of what this could be, that would be appreciated.

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

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

Unity Editor and Player freeze after several minutes of gameplay without leaving any useful log or debugging information. 1 Answer

Troubleshooting sudden editor lag 0 Answers

Unity editor opens scene a million times until computer freezes 0 Answers

Help! Unity freezes for ~3 seconds every ~7 seconds in-editor 0 Answers

How to solve unity editor freezing at Application.EnterPlayMode in play mode after building? 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