• 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
Question by RGI · Apr 28, 2013 at 10:13 AM · androidjavascriptscene-loadingloadingfiles

Loading scene in background?

Hi, I have a scene that takes up to 30 seconds to load on weaker android devices (around 1ghz cpu). Iam trying to find a way to either shorten that time or make it to preload the files. Ive already searched for quite some time and tried some stuff (somehow I even managed to launch 2 scenes at the same time). The only thing that seemed to come close was a script that would load the scene while the first scene was running but it didnt wait for user to launch it, it just started the moment it was loaded. Does anyone know if I can make it to wait for the user to launch the scene?

Comment
whydoidoit

People who like this

1 Show 0
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

Answer by whydoidoit · Apr 28, 2013 at 10:25 AM

Presumably you were using LoadLevelAsync?

    var loader = Application.LoadLevelAsync("somelevel");
    loader.allowSceneActivation = false;

    //When ready
    loader.allowSceneActivation = true;

See this: http://docs.unity3d.com/Documentation/ScriptReference/AsyncOperation-allowSceneActivation.html

Comment
tmendez

People who like this

1 Show 14 · 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 RGI · Apr 28, 2013 at 11:27 AM 0
Share

Iam sorry but Iam not familiar with that type of variable, so I really dont know how to use it. Am I supposed to somehow execute that variable? I have no idea how to do that.

avatar image whydoidoit · Apr 28, 2013 at 01:59 PM 0
Share

I'm a bit confused as I've given you all of the code you need.

Load the level like I show, then when you want to activate it set

   loader.allowSceneActivation = true;

 
avatar image RGI · Apr 28, 2013 at 04:34 PM 0
Share

I dont know wtf just happend but now I cannot acces the scene I was working with. This is the script I used: var start : GUITexture; var loader = Application.LoadLevelAsync("game1");

 function Start () {
 
 loader.allowSceneActivation = false;
 
 
 
 }
 
 function Update () {
 
    
 for (var touch : Touch in Input.touches){
 
  
         
         
 if (start.HitTest (touch.position)){
 if(touch.phase == TouchPhase.Began){
 loader.allowSceneActivation = true;
 }
 }
 }
 }

When I tried it, it skipped the whole scene and just loaded the "game1". Now I cannot open that scene in unity. It just opens "game1" instead. wtf? Every other scene is working.

avatar image RGI · Apr 28, 2013 at 04:40 PM 0
Share

Seems like the original scene now has the same size as the "game1". Could it be I somehow overwritten that scene?

avatar image RGI · Apr 28, 2013 at 04:50 PM 0
Share

after some testing it seems like what your script does is that it replaces current scene with the scene named in the script. I made a new scene, putted the script in there and did the same thing, replaced that scene with "game1".

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

14 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

Related Questions

Problems with Playerprefs script 1 Answer

Slow Android load times 0 Answers

how to translate normal 3d project to VR? 1 Answer

Accelerator and how to limit player movement (Android) 0 Answers

disable GUI when loading is done 5 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