Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 hvilela · Oct 10, 2012 at 03:29 AM · editorthreading

Threading in Unity Editor

I would like to call Lightmapping.BakeAsync, wait it to finish (without freeze the editor) and do something else when it's done. As long I can't call Unity API from any thread but the main one, how could I achieve that?

 [MenuItem("Bake/Bake")]
 public static void Bake() {
     // Do something
     Lightmapping.BakeAsync();
     // Wait till it's done.
     // Another Unity API call
 }
Comment
Add comment · Show 1
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 vargonian · Jul 16, 2014 at 04:27 AM 0
Share

Did you ever solve this? I'm having this exact issue. Why can't a $$anonymous$$enuItem run things on the main thread? I've got no access (that I'm aware of) to any Update method or OnGUI or anything, since $$anonymous$$enuItem methods are static.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Eric5h5 · Oct 10, 2012 at 03:40 AM

Check Lightmapping.isRunning in a coroutine.

Comment
Add comment · Show 9 · 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 hvilela · Oct 10, 2012 at 03:46 AM 0
Share

Coroutine in Unity Editor? I can't find documentation about it, but all answers here says it can't be done.

avatar image hvilela · Oct 10, 2012 at 03:48 AM 0
Share

Also, StartCoroutine is not static and I'm just calling a static method from the menu.

avatar image Eric5h5 · Oct 10, 2012 at 03:57 AM 0
Share

Check it in EditorWindow.Update rather.

avatar image hvilela · Oct 10, 2012 at 04:03 AM 0
Share

Thank you, but I don't have an EditorWindow, it's just a static method call from the menu.

avatar image MultivariousDev01 · May 07, 2015 at 12:52 AM 1
Share

Couple of years late here, but if you want to run a coroutine from an editor script, you just have to subscribe to EditorApplication.update and manually iterate through your coroutine in the subscribing function.

Show more comments

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

11 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

Related Questions

How do you stop multithreading in editor? 1 Answer

How to clear UnityEditor memory? 0 Answers

Some GameObjects not visible in android build but work fine in the editor? 0 Answers

Constant error : SaveSnapshot called without previous call to MakeSnapshot 1 Answer

Loading a large external image to texture without freezing the game? 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