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 Shultc · Jan 19, 2016 at 07:55 AM · c#unity 5editorcoroutinewindows

Coroutine works in editor, but not in build Windows application

My Coroutine work in the Editor in the "Play mode", but not in build application. So, I have Coroutine in my project:

 IEnumerator Scream()
     {
         Screamer.GetComponent<Screamer>().makeActive();
         yield return new WaitForSeconds(3);
         Application.LoadLevel(Application.loadedLevel);
     }

I call Coroutine from Update() function:

 void Update () {
     ...
     if (...)
     {
         StartCoroutine(Scream());
     }
 }

In Editor (I have Unity 5.3.1f1 Personal) everything works fine, so I can't imagine, what can be wrong here.

Thank you in advance.

UPDATE: Everything else works fine.

Comment
Add comment · Show 12
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 alishka · Jan 19, 2016 at 08:43 AM 0
Share

Are you sure your if is triggered on your device? What's the condition?

avatar image fffMalzbier alishka · Jan 19, 2016 at 09:59 AM 0
Share

Good Point do something in that if that you can miss to find out if its trigger at all (Debug.Log("For example");.

avatar image Bonfire-Boy fffMalzbier · Jan 19, 2016 at 10:40 AM 0
Share

Agree with adding some logging. But seeing as that's only going to be of use if you check the log, it might be worth doing that first. If you've already done that and seen nothing that looks relevant then that's information that should be in the question.

Also, we have the "doesn't work" doesn't tell us much problem here. Please describe fully. For example, is it that none of the lines in the CR appear to run? Or is it that (for example) the first line appears to run but not the subsequent lines.

avatar image Shultc alishka · Jan 19, 2016 at 04:14 PM 0
Share

I have pretty complex "if" settlement with multiple triggers. To be sure, I changed it to simple timer:

 timeLeft -= Time.deltaTime;
 Debug.Log(timeLeft);
 if (timeLeft < 0)
 {
     StartCoroutine(Scream());
 }

And still the same: In Editor Coroutine starts, in Windows application — not.

avatar image Bonfire-Boy Shultc · Jan 19, 2016 at 04:30 PM 0
Share

How do you know it doesn't start? Is the call to StartCoroutine happening? Is the Debug.Log showing that timeLeft drops below zero ?

Show more comments
avatar image yisusgamer55 · Jun 09, 2020 at 04:08 PM 0
Share

I know this post is very old, but did you find a solution? I have exactly the same problem.

avatar image Bonfire-Boy yisusgamer55 · Jun 09, 2020 at 06:15 PM 1
Share

First of all, your "answer" wasn't an answer, so I have converted it to a comment.

Second, you're better off posting a new question rather than tagging onto this one. Your situation isn't going to be exactly the same because your code will be different. So in your question, show us your code. Let us know what you've done to investigate the problem (eg looking at the logs).

Note that in the OP's situation it turned out that their CR was starting, and then something was going wrong. I gave up on them because they seemed to expect us to be $$anonymous$$d-readers. "Something not working" is just not going to help. It's up to you to investigate what's not working, we can only point in certain directions.

Generally speaking - you need to use the logs if debugging a build. Add Debug.Log calls. If the logs show a Null or $$anonymous$$issing Reference exception, then if the log doesn't hel you work out what's missing then you need to add stuff to catch the null and tell you what it is.

So do some investigation and then if the problem persists, start a new question showing your code and showing what errors if any the log throws up.

avatar image yisusgamer55 Bonfire-Boy · Jun 09, 2020 at 08:12 PM 0
Share

Hi, it turns out I kept looking, and my problem turned out to be using WaitForEndOfFrame, and it turns out that this "function" doesn't run on builds. I'm sorry for my English.

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

7 People are following this question.

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

Related Questions

Multiple Cars not working 1 Answer

Startcoroutine not working second time 2 Answers

Issues with my loading screen 0 Answers

Second Coroutine isn't working Unity 1 Answer

Coroutines randomly stop working 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