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 Hassan-Kanso · Jan 27, 2020 at 06:49 PM · androidiosloadingmemorypanel

Phone App(not game) : should I load UI panels as assets or load it as new scene?

Hello everyone,

we're developing a phone app and as far as I know, the concept of activity(from android) is not well described on Unity.

Top down approach of what I want to do:

I want to implement activities(again, similar to those from android studio), using the UI of unity and c# code to handle UI events. An activity is one gameobject(panel with handling scripts) with children gameobjects(buttons, texts...).

I want to compromise between loading time and memory allocation. I was able to think about 3 approaches as solution:



1st Approach:

Group related panels together and make every group one scene. in every scene, show the panel we want to use using the "enabled" variable. because all scripts are just ui events handling, there will be nothing in the update() function and the panels scripts will not "overlap".

pros:

1.No loading time when we switch between panels(in same scene).

2.Panels' animations are easy to implement.

3.we can access any other script's functions and variables from any script we want.

4.Data will not be lost unless we clear them manually.

5.Easy to implement back function (back from details panel to items list panel) .

cons:

1.High usage of memory?

2.We have to clear unused data manually.

3.There will be one large group, and the rest will be minor groups.


2nd Approach:

We put every panel in different scene and we load it only when needed. Accordingly, we use DontDestroyOnLoad for the panels we don't want to lose.

pros:

1.Optimized memory usage.

2.Activities are more organized(every panel in different scene).

cons:

1.We have to avoid duplication in panels and I believe this is going to be messy.

2.If user go from scene1 to scene2 without destroying the panel from scene1, then he decided to go from scene2 to scene3, it's hard then to know if the panel from scene1 is still there and that we shouldn't destroy it.


3rd Approach:

we create one scene and load needed panels as prefab at runtime. We can do it using the line below:

 Instantiate (Resources.Load ("panel1_prefab") as GameObject);



pros:

1.Easy way to avoid panels duplication.

2.Optimized memory usage.

3.Frequently used panels will never be destroyed(solve 3rd cons of 2nd approach).

4.Unused panels will never be loaded.

cons:

1.Is Resources.Load faster than loadscene?


I would like to use the first approach since panel size is negligible comparing to content size, but we still don't have overall view on panels count and size...and what panels are related to each other(grouping).

Any thoughts/ideas from experts in this case?

Thanks for reading

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.

Follow this Question

Answers Answers and Comments

281 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to have 2 sets of textures and make sure only one is loaded? 0 Answers

Memory usage for the simplest iOS/Android app grows over time, says Unity 3.5 Profiler 0 Answers

Detect how much RAM is available? (iOS) 1 Answer

OutOfMemoryException when downloading files via the www class (iOS and Android) 1 Answer

iOS memory inconsistent between builds 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