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
0
Question by cj_coimbra · Sep 14, 2011 at 12:10 PM · fpslistloadingipadthreads

Performance issue loading resource

Greetings,

I would like to hear some suggestion on how could I get over this situation:

I have a catalog that is presented in a scroll view. It´s components are stored in a text asset with over 9,000 lines (each line represents an indivudual entry with it´s features) and parsed into a list.

The problem is that the app takes too long to load and build the list. Usually it takes over 20 seconds to load (considering iPad... make it ~10 seconds on the macbook using unity editor). The main interface and user interaction will only take place when the loading process is complete. Our project would only be fine with 5 seconds to load.

Basically the text asset has it´s lines splitted into a string array and then each of the +- 9,000 lines get parsed again with Split(...) to extract the data for each component.

I tried to load 500 entries, start the app and later load bit by bit while still running the app, but it get´s the FPS to the ground (~3 to 8 FPS as opposed to 200+ FPS using the regular way).

I also tried to load 500 entries and then given specific triggers load a bit more, like when you scroll the scrollview too much it would load 40 more entries, but it´s lags too much (~1 second) and it doesn´t look good at all.

I did a method that checks if the touch device isn´t getting any touches for some time and then load all the entries it can while it´s idle touch-wise. But this does not solve the problem.

I thought on threads but I am not sure how C# threads would work on iPad.

Well, I hope someone could give me a suggestion on this situation!

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
0

Answer by aldonaletto · Sep 14, 2011 at 01:39 PM

Have you tried to split the reading function over several frames using yield? You could read the 400 first lines, then enter a loop where up to 40 lines were read and the yield instruction executed until the whole file were read - something like this pseudo code:

function Start(){
    ... // read the first 400 lines
    while (not eof){ // pseudo code, obviously
        ... // read up to 40 (for instance) lines
        yield; // suspend routine and return to this loop next frame
    }
}
Yield places the function on hold and lets Unity to do other jobs until the next frame, when it returns to the instruction right after yield and resumes the execution.
Comment
Add comment · Show 2 · 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 cj_coimbra · Sep 14, 2011 at 02:05 PM 0
Share

I´ll try that right away.

avatar image cj_coimbra · Sep 19, 2011 at 11:42 AM 0
Share

The coroutine aproach didn´t solve the performance issue. Yet it made the problem less visible.

I moved to another aproach which consisted of not loading/parsing the catalog elements at the startup. Ins$$anonymous$$d of that, I loaded a simplified version of those elements only with the necessary information to render the buttons on the scroll view. Then, when a button gets clicked the "real" version is fully loaded and the lag is close to none.

The initial loading time dropped 66% of the original time (20 secs to 7 secs on iPad 1) with 9,316 elements parsed.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Saving and loading array (/list) of integers locally 1 Answer

How to Fix This? 1 Answer

Loading animation while Application.LoadLevel in UnityFree 0 Answers

iPad fps throttled? 2 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