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 madflyskills · Jul 01, 2013 at 02:29 PM · asyncadditivelevel loadonlevelwasloaded

What is the best way to detect level load on additive/asnyc level loads

I basically want to duplicate the functionality of OnLevelWasLoaded(int level) but for these functions: Application.LoadLevelAsync

Application.LoadLevelAdditive

Applicaiton.LoadLevelAdditiveAsync

Comment
Add comment · Show 3
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 madflyskills · Jul 01, 2013 at 06:55 PM 0
Share

nobody has an idea?

avatar image killer-zog · Jul 01, 2013 at 06:59 PM -1
Share

provide more info of what are you looking for.

avatar image madflyskills · Jul 01, 2013 at 07:06 PM 0
Share

Well OnLevelWasLoaded gets called when a new scene is loaded. However, it doesn't work when you load a level asynchronously or additively. I want to be able to know when a scene is loaded regardless of whether it's done regularly, ascynchronously, or additively.

I have taken a glipse at GetStreamProgressForLevel, but I'd rather not have something constantly running in Update. And if I do, then how can I use it correctly.

1 Reply

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

Answer by iwaldrop · Jul 01, 2013 at 09:39 PM

In cases like this I use a LevelLoader which has events that get called. You declare your own events and then call them before and after the load event.

 public delegate void LevelWillBeLoaded();
 public delegate void LevelWasLoaded();
 
 public static event LevelWillBeLoaded OnLevelWillBeLoaded;
 public static event LevelWasLoaded OnLevelWasLoaded;
 
 public void LoadLevel(string levelToLoad)
 {
     StartCoroutine(LoadLevelCoroutine(levelToLoad));
 }
 
 IEnumerator LoadLevelCoroutine(string levelToLoad)
 {
     if (OnLevelWillBeLoaded != null)
         OnLevelWillBeLoaded();
     yield Application.LoadLevelAsync(levelToLoad);
     if (OnLevelWasLoaded != null)
         OnLevelWasLoaded();
 }
Comment
Add comment · Show 4 · 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 madflyskills · Jul 01, 2013 at 10:25 PM 0
Share

awesome! I was wondering if there was a solution if I didn't control when the application called LoadLevelAsync/Additive. In my case a wrapper isn't really an option

avatar image iwaldrop · Jul 01, 2013 at 10:59 PM 0
Share

There isn't anything else that I'm aware of. If you don't $$anonymous$$d me asking, why is a wrapper not an option?

avatar image madflyskills · Jul 02, 2013 at 12:12 AM 0
Share

i want a my code to react to any call to Application.LoadLevel in any form. I don't want the user to have to have to call another function to load a level. I want it to be generic. Right now it responds to Application.LoadLevel, but it doesn't respond to LoadLevelAsync. I guess using GetStreamProgressForLevel is unavoidable?

avatar image iwaldrop · Jul 02, 2013 at 12:52 AM 0
Share

Ahh, ok. Figured it was an in-house project. For a tool then, yeah, as far as I know that would be your best bet.

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

18 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

Related Questions

AsyncOperation for SceneManager.LoadSceneAsync doesn't adhere to Application.backgroundLoadingPriority 1 Answer

Load Level Additive Async Lag spike 0 Answers

UnloadScene Working but not UnloadAsync? 0 Answers

Prevent LoadLevelAdditiveAsync from halting the app? 3 Answers

How to make Awake and Start get called in order with additive scenes? 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