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 jahndal · Feb 17, 2017 at 10:08 PM · scene load

AsyncOperation.allowSceneActivation seems to be ignored

Hi all.

I try to preload a main menu scene while playing an intro, and then show that menu when intro is skipped or finished. All posts that I've seen state that if you load scene async with:

 op.allowSceneActivation = false;    

then op.progress will, hmm... progress up to 0.9f and op.isDone will be false. Then I can manually set allowSceneActivation to true when I want to, and scene will appear. So I wrote this:

 private AsyncOperation op;
 
 void Awake()
 {
     op = SceneManager.LoadSceneAsync(Name, LoadSceneMode.Single);
     op.allowSceneActivation = false;
 }
 
 void Update()
 {
     if (op.progress >= 0.9f && m_Proceed)
     {
         if (!op.allowSceneActivation)
         {
             op.allowSceneActivation = true;
         }
         else if (op.isDone)
         {
             // Switch to main menu processing
         }
     }
 }

But the first time Update is called my async operation has progress = 1f and isDone = true whilst allowSceneActivation = false. My menu comes on screen though I didn't allow it. It does work this way in Single and Additive loading modes. I tried free versions of Unity 5.5.0f3 and 5.5.1p3 and both have the issue.

Am I missing something? How can I preload scene without showing it up on the screen until I want to?

Thanks.

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
4

Answer by jahndal · Feb 19, 2017 at 10:57 PM

It's a known bug: https://issuetracker.unity3d.com/issues/loadsceneasync-allowsceneactivation-flag-is-ignored-in-awake

As suggested in a bug report, loading scene in Update() instead of Awake() fixed the problem.

Comment
Add comment · Show 3 · 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 adammakDelivr · Sep 17, 2020 at 03:53 PM 0
Share

For some reason at the start of the coroutine (before creation of AsyncOperation object) you need to insert:

yield return new WaitForSeconds(0.1f);

Funny enough, inserting yield return null or yield return new WaitForEndOfFrame

doesnt work any more (probably worked in Unity 2018 and 2019)

avatar image Twin-Stick adammakDelivr · Dec 27, 2020 at 05:10 AM 0
Share

This is crazy! I've been smashing my face on my keyboard all day - only to add this yield before the async load..... WHY IS THIS A THING!!!!????

(PS - Thankyou!)

avatar image FunFreighterGames adammakDelivr · Feb 06, 2021 at 03:42 AM 0
Share

omg! thank you! This was driving me absolutely nuts!

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

7 People are following this question.

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

Related Questions

Switching between several levels 1 Answer

I need to restart scene on collision ( when ball hits bottom wall), but this code doesn't work . What should I do ? 1 Answer

How to transition from Load to scene ? 1 Answer

Is there any ideas to load Unity scene asynchronously? 1 Answer

Loading an additive scene once and only once? 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