• 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 Ham5andw1ch · Jul 09, 2015 at 12:30 PM · androidunity 52dlagscene change

Massive lag when changing scenes on Android.

I am making an endless game in unity 2d. The screen layout resembles flappy bird, and as such has obstacles, your score, you, and your controls. The main menu is part of the same unity scene and appears when the app starts and when you die. You can buy characters, which are just sprite changes in the shop. The shop is in a separate scene. The scene change was just fine, but after adding music to both scenes, and more costumes, it takes 8 seconds to go from menu to shop. 12 seconds to go back to menu. Switching to the credits scene is instantaneous, but going back takes 6 seconds. This doesn't seem like much, but I'm sure users will find it unacceptable. How do I fix this? BTW, I posted this to the forums earlier without realizing there was an answers section.

Comment
Add comment · Show 2
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 RayJr · Jul 09, 2015 at 12:55 PM 0
Share

I don't know of a magic bullet answer. How big are your music files? how many sprites are you loading in this scene? You could break out the main menu and the level into different scenes. That would split the load - including halving the music load.

avatar image Ham5andw1ch · Jul 09, 2015 at 01:11 PM 0
Share

I'll have to count when I get on. I know that my music files are 3-5 $$anonymous$$utes long. $$anonymous$$y game also relies alot on canvases.

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Ham5andw1ch · Jul 09, 2015 at 02:43 PM

I decided to combine them all into one scene. That way, it's not having to load a scene at all. Just set the active status of a canvas. It worked well in the editor, so I'm hoping it works. Updating the app on my phone now.

Comment
Add comment · 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
0

Answer by RayJr · Jul 09, 2015 at 01:34 PM

Ah, ok. There are two problems. That is a really long file to load into memory on android. You should consider cutting it way down and looping it. maybe to 30 seconds or less? Also, you can get a free audio editor and lower the quality to shrink the size. You likely won't even notice the difference on a mobile device speaker. If you don't want to cut the music up, definitely make the main page a separate scene. Loading 6 - 10 minutes of music is going to kill your load time.

Also, Canvas is bad news for Mobile. I'm not sure why, but they mention it a couple of times during this live training on Mobile Development. That is probably way more work to change though. You should start by cutting down your music and/or splitting your game to two scenes and see how far that gets you. You may not need to change out the canvas at all.

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 Ham5andw1ch · Jul 09, 2015 at 02:51 PM 0
Share

I fixed it. I combined all the scenes into one and set the active statuses of canvases. Works like a charm. Also, the music I'm using doesn't loop well cut in the middle. I'm using $$anonymous$$evin $$anonymous$$acleod's ouroboros, level up, and rhinoceros.

avatar image Ham5andw1ch · Jul 09, 2015 at 02:51 PM 0
Share

Thanks for helping though. The unity community is so nice.

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

some android phone's touch won't work sometimes with my game app, but it works perfectly in my phone. 0 Answers

Somes problems on my 2D space shooter game (Unity 5.5.0p4) 0 Answers

Simple 2D motion around a circle is laggy in Android. 1 Answer

My app freezes on specific y coordinates 0 Answers

Unity 2D autoScale the sprite objects in worldspace according to resolution? 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