• 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 Toolism · Sep 11, 2014 at 09:59 AM · jitterspikes

Constant asset preloading on iPhone 4. How to preload once and for good?

I've been having some problems with I guess asset loading? I am seeing some wierd hickups when I test my game on iPhone 4. On iPhone 5, iPad Mini, iPhone 5S it runs smooth and the background preloading is nonexistent after the first few frames.

I have unity pro so I've tested the game in the profiler and turns out its mostly due to overhead by Loading.UpdatePreloading -> Application.Integrate Assets in Background Here are the screenshots from the profiler on iPhone4 :

Hiccup 1:

alt text

Hiccup 2:

alt text

I might not fully grasp whats going on but I was sure that if I load everything up at the beginning then there will no longer be any more loading? Why does unity keep doing stuff in the background when I've already loaded everything up? (If you look at the screenshots the 2 hickups are caused by UpdatePreloading but actually update preloading is present in every frame from the beginning)

The way I have my scenes set up is this: I have a loading scene where I basically create all the object pools , create physics stuff, load prefabs and so on and when its done I load the Game scene.

Here is the code for loading my scene. It's on my persistent object that stays between the two scenes and creates all the controllers.

 void Start()
     {
         DontDestroyOnLoad(gameObject);
 #if UNITY_IPHONE
         if(iPhone.generation == iPhoneGeneration.iPhone4)
         {
             Application.targetFrameRate = 55;
             Time.fixedDeltaTime = 1.0f/60.0f;
             useSlowConfig = true;
             QualitySettings.vSyncCount = 0;
         }
         else
         {
             Application.targetFrameRate = 60;
             Time.fixedDeltaTime = 1.0f/60.0f;
             QualitySettings.vSyncCount = 1;
         }
 #endif
 
         if(useSlowConfig)
         {
             soundDisabled = false;
             adsDisabled = true;
             gameCenterDisabled = false;
             particlesDisabled = false;
         }
 
         Debug.Log ("----------------APP INFO------------------");
         Debug.Log ("target framerate "+Application.targetFrameRate+" fps");
         Debug.Log ("fixed timestep "+Time.fixedDeltaTime);
         Debug.Log ("----------------APP INFO------------------");
 
         // start the loading coroutine
         StartCoroutine(addTouchKit());
         StartCoroutine(prepareAssets());
         StartCoroutine(updateTextEffect());
 
         Debug.Log ("all coroutines started");
     }
 
     IEnumerator prepareAssets()
     {
         Debug.Log ("loading ASSETS started!"+" - time["+Time.time+"]");
         // load internals
         yield return StartCoroutine(loadInternals());
         Debug.Log ("INTERNALS loaded"+" - time["+Time.time+"]");
         // load externals
         yield return StartCoroutine(loadExternals());
         Debug.Log ("EXTERNALS loaded"+" - time["+Time.time+"]");
 
         // show tap to continue after everything is loaded
         infoText.text = "TAP TO CONTINUE";
         infoText.characterSize = 0.07f;
 
         // start looking for tap trigger
         yield return StartCoroutine(loadNextScene());
 
         allDone = true;
         touchTrigger = false;
         Debug.Log ("ALL ASSETS loaded!"+" - time["+Time.time+"]");
     }
 
     IEnumerator loadNextScene()
     {
         Debug.Log ("waiting for mouse press...");
 
         while(touchTrigger == false)
             yield return null;
 
         Debug.Log ("loading GAME! "+Time.time);
 
         AsyncOperation async = Application.LoadLevelAsync(2);
         yield return async;
 
         Debug.Log ("loading GAME finished "+Time.time);
     }
 
     IEnumerator loadInternals()
     {
         Debug.Log ("loading internals! "+Time.time);
 
         //saveController.initializeSaveData();
 
         instanceManager.cachePrefabs();
         instanceManager.seedObstacles();
 
         yield return null;
     }


To summarize my question:

1) How to load a scene so that it doesn't continuously preload stuff in the background & why is this a problem only on iPhone4

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

0 Replies

· Add your reply
  • Sort: 

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

2 People are following this question.

avatar image avatar image

Related Questions

Enemy Jitters When Following 0 Answers

Damp Camera rotation caused by Animations 1 Answer

Proper Fixed Timestep for 30 FPS 1 Answer

iOS Lag From Updating Score 0 Answers

How can I avoid jitter of house? 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