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 MemoryPattern · Jun 22, 2016 at 09:21 PM · listcoroutinequeue

Queue a Coroutine with a List?

I have a script that displays notifications on-screen, the text fades in and out through Coroutines so I need both to of completed before displaying the next. I had the code setup but due to a power outtage I lost the script before I could save.

I was using a List to store all of the notifications and then displaying each one by one, making sure that I wasn't currently displaying one before playing the next. But I have no idea how I went about this and it's been frustrating me for the last day.

Does anyone have anything that might point me on the right track?

Comment
Add comment · Show 2
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 Owen-Reynolds · Jun 23, 2016 at 06:40 AM 0
Share

I just can't get past that story.

You forgot the basic idea about code you wrote. Code you just now wrote (since it wasn't even saved.) And you lost it in a power outage? So, a plugged-in computer with no battery?

And you wrote that down as part of your Q, because, I assume, you don't just want messages to display one after another. You're hoping to see some off-beat sub-optimal solution similar to what you did, which will give you the feeling of recovering a memory?

avatar image MemoryPattern Owen-Reynolds · Jun 23, 2016 at 08:12 AM 0
Share

I remember the basic idea, but considering that I had no idea how to go about it in the first place it was a spur of the moment thing getting it to work. I'd lost it a week ago and have spent the last week trying to re-write what I did but have not yet gotten it to work again.

Yes, a computer that goes off in a power outage probably wouldn't have a battery, would it? Otherwise I wouldn't be posting this question.

Yes and it did. The answer below helped me to remember a part that I forgot in the code I have currently.

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Hellium · Jun 22, 2016 at 09:22 PM

I haven't tested the following code, but it gives the idea :

 void Start()
 {
     StartCoroutine( ProcessNotifications() ) ;
 }
 
 IEnumerator ProcessNotifications()
 {
     while( true )
     {
         while( notificationsList.Count > 0 )
         {
             yield return StartCoroutine( notificationsList[0] ) ;
             notificationsList.RemoveAt( 0 ) ;
         }
         yield return null ;
     }
 }
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 Destr · May 30, 2018 at 11:18 PM 0
Share

Thanks a lot, saved my life

avatar image Hellium · May 31, 2018 at 06:03 AM 0
Share

Using a Queue ins$$anonymous$$d of a List would have been more efficient.

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

6 People are following this question.

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

Related Questions

How do multiple objects in sequence from a queue? 0 Answers

Unit Production Queue Display 0 Answers

Enemy Database using list/dictionary to store stats (C#)? 1 Answer

Reset animation in animator when execution the same animation in row 0 Answers

InvalidOperationException: Operation is not valid due to the current state of the object 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