Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 SisterKy · Jan 12, 2010 at 04:51 PM · crashdebug

Debug.Log doesn't get called when Unity freezes?

In my scene I have 2 Charas (Wasch and Lucat) walking next to each other.
By hitting space, the player can switch between the two, which ever he wants to "posses".

One script controlls the switching.
Another script takes care of the camera-movement (handled with waypoints)

The Controller-Script:

private var waschActive : boolean = false;

private var camCall = GameObject.Find("Main Camera").GetComponent("CamMove");

function Update () { if (Input.GetButtonDown("Jump")) // on Spacebar down, do: { // switch between Charas waschActive = !waschActive;

     // tell the MainCam, which PC to possess
     if ( waschActive )
     {
         Debug.Log("waschActive");
         //camCall.LucatToWasch();
     }
 }

}

Here's the function that gets activated by the camCall.

function LucatToWasch () { Debug.Log("LucatToWasch started"); while ( !lastPointReached ) { //as long as first waypoint hasn't been reached yet, //lerp Camera towards it and make it face in the same direction while ( !firstPointReached) { Debug.Log("First Point not reached yet"); Debug.Log(transform.position); transform.position = Vector3.Lerp (camPositionLucat.position, camPathPointLucat.position, 5); Debug.Log(transform.position);

     if (cameraTrans.position == camPathPointLucat.position)
     {
         Debug.Log("first Waypoint reached");
         firstPointReached = true;
     }
  }

} }

Currently the camCall is commented out and if I hit space I get the "WaschActive"-Message.
(Other functionalities I implemented and left out for clarity work perfect as well)

Now the strange thing is: if I un-comment it, Unity freezes before it even prints the "WaschActive"-Message! O.o No Debug.Log-calls at all (non of the camMove-script either). No errors. The statistics-window freezes as well...

So what's happening?
Does Unity freez before it even reaches the problematic code??
Will Debug.Log not get called if it freezes.

Thanks a lot in advance!

Greetz, Ky.

~~~~~~~~~~~~~

Edit:
As burnumd said and GargerathSunman on the Forums confirmed, Unity will always hang before drawing Debug.Log!! So for infinite Loops, Debug.Log won't do...

I put in some yield; and now it doesn't crash anylonger! =D It's still weird, but sort of works... =)

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
3
Best Answer

Answer by burnumd · Jan 12, 2010 at 07:07 PM

What's likely happening is that those while loops are just spinning away causing Unity to freeze before it gets a chance to redraw the console. If you check the actual logs (press "Open Editor Log" in the control bar of the console before you hit play), you should see your log messages at the very end.

Comment
Add comment · Show 2 · 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 SisterKy · Jan 12, 2010 at 07:33 PM 0
Share

Never saw that EditorLog-Button! aha! =D ... I tried what you said and edited my question, though I don't think it's of any use...? But anyway thank you for your answer! =) I suspected infinity-loops at first but thought that can't be it if the Debug.Log doesn't get called. But if it's possible that it does get called, but just not drawn, that's probably it... If the cam never reaches the first PathPoint, I suppose my lerp doesn't work :-/ what am I doing wrong?

avatar image berk_can · May 04, 2020 at 09:34 PM 0
Share

thank you so much, learning this was big help, btw if there is any person who want to find location of current log file it is at: C:\Users\AppData\Local\Unity\Editor\Editor.log

avatar image
4

Answer by Dreamora · Jan 12, 2010 at 08:10 PM

Your camera code is a real problem.
You use while loops in there, that never use yield. That means they run at full power and prevent any other code in your project and in case of editor running the editor, from doing anything at all. Thats an infinite loop and within the editor, the editor will just forcefully kill it if it detects 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 SisterKy · Jan 12, 2010 at 08:13 PM 0
Share

Yes! =D I put in yields, now it works... sorta, kinda, but anyway! At least something to work with =D (I knew about yield but totally misunderstood it's usage...) Thank you =)

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

1 Person is following this question.

avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Unity iPhone is crashing whilst running my game - how to debug? 2 Answers

How do I debug a Linux crash? 1 Answer

How can I find editor log file? 5 Answers

Stop everything on first error + state machine 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