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
1
Question by ryvianstyron · Oct 01, 2016 at 06:54 AM · c#animation2dgui

Custom AsyncOperation to show LoadingImage for slowish XML conversion & email upload method in Unity?

Hi,

  • I have a Unity UI tool project that converts user input for stories into XML that can be read as game data (Basically a story content creator) Once the conversion is done - it sends the XML as a string via email.

  • During the conversion / sending process - there's a little bit of a pause before my "successfully sent!" message pops up and I wanted to add an animated loading image in that time and it got me interested in trying to figure out Coroutines with a seemingly non-persistent function.

My slow function would be "ConvertAndUpload()":

it includes multiple try / catches for error reporting to the user(E.g. If they've filled out information incorrectly or missed out filling certain things, or not followed certain story writing conditions needed for the game) and only calls a "DisplayDoneMessage()" if the conversion has been successful and the email has also been sent successfully. For this reason, I feel like it's not exactly a persistent process as such, because it can be interrupted.

Research:

  • Using AsyncOperation for our own services | (Was interested in CasualT's implementation , however, felt I needed clarification on how to setup the "slow function" due to my unique code scenario, OR that I should be implementing this differently in a way I wasn't aware of)

My previous use of Coroutines:

  • Simple with 2D/3D animations, regular version of "WaitForSeconds(n);

Question:

I was wondering if anyone could give me some direction on how I could go about implementing this. An implementation that could handle try/catches occurring within the slow function, while displaying some kind of loading animation until the slow function has been successfully completed in terms of:

  1. Successful conversion

  2. Successful email sent

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by neuroKip · Oct 13, 2017 at 11:09 AM

I am not sure if this applies for the OP situation, but hope it at least helps someone in a similar situation.

https://docs.unity3d.com/ScriptReference/CustomYieldInstruction.html

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

No movement when animation plays (2d) 1 Answer

urgent, pls help. Selection through keyinput in Canvas 2 Answers

Space opening main menu (undesired) 0 Answers

UI Prefab not instantiating on build for Android. 1 Answer

How to make Animated GUI element. 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