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 /
This question was closed Apr 08, 2018 at 05:46 PM by charlenedanes for the following reason:

I already solved it.

avatar image
0
Question by charlenedanes · Apr 08, 2018 at 05:13 PM · wwwienumeratorpanelwhile-loopstopping

while (true) loop stops when panel is set to active

The increment of x stops if the second condition has been entered. Meaning the loop stops (right?)

   IEnumerator CheckConnection (string url) {
              while (true) {
                  yield return new WaitForSeconds (1);
                  x++;
                  WWWForm form = new WWWForm ();
                  WWW www = new WWW (url, form);
                  yield return www;
                  if (www.isDone && www.bytesDownloaded > 0) {
                      Debug.Log (x);
                  } else if (www.isDone && www.bytesDownloaded == 0) {
                      showLoginModal ();
                      loginModalText.text = "Please check your internet connection.";
                      closeButton.onClick.AddListener (hideLoginModal);
                      Debug.Log (x);
                  }
                  yield return null;
              }
          }
Comment
Add comment · Show 4
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 ♦ · Apr 08, 2018 at 05:23 PM 1
Share

Hrm, are you asking us to test your code for you? You tell us if it stops or not! :D Some disagree with me but as far as I'm concerned, while you are anything less than Advanced at program$$anonymous$$g and Code dev NEVER use while(true). Ever. There are very very few cases where you can not use something else which would inevitably be safer than a non-ending loop. After all, given that its a Ticking Game Engine... the loops have already been made for you in the form of Update etc.

Always made sure to break from a loop or at least to provide a break escape. return from a function.

That said, if it works and isnt broken...win.

avatar image charlenedanes meat5000 ♦ · Apr 08, 2018 at 05:28 PM 0
Share

no. it really is stopping when the panel is set to active. i dont know why...

avatar image charlenedanes meat5000 ♦ · Apr 08, 2018 at 05:32 PM 0
Share

plus I can't StartCoroutine in Update() so I'm stuck in calling it at Start() and assigning an Update() - like loop in the IEnumerator

avatar image charlenedanes meat5000 ♦ · Apr 08, 2018 at 05:41 PM 0
Share

Nvm. I solved it. This is because the gameobject the script is attached to is being disabled when the panel is set to active. Thank you!

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

79 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 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

Using Data with a Button? 1 Answer

Can you pass a RawImage to an IEnumerator in another script? 0 Answers

When to use IEnumerator ? 1 Answer

wait WWW to finish download with yield does not work 0 Answers

Many loops to instantiate different prefabs during a given time 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