Hello,
I make book app in unity. I have a performance problem. My book app has 300+ scenes and every scene has only one TMP, one next button, one previous button. I save the last scene index number read to playerprefs. My book app is getting very slow after 100. scene and getting closed. I deleted all of buttons and TMPs. I create 150 scenes as empty but I faced same problem. There is no problem when it runs on my Unity editor. There is a problem when I install it to my phone. My phone is Samsung S10 Plus and Android 10. I think, it is caching somethings this is why my book app is geting slow and getting crash. But I couldn’t find why is. What can I do to solve this problem? Could you please help me? Thanks.
Try using the Profiler with a mobile build. I’d suspect you’ll see memory usage continuing to increase. If so, you’ll want to see what exactly is using the memory. Might need to do deep profile, or try the memory profiler package.
Deep profiler is very memory and performance intensive in the Editor, so I don’t recommend just letting it run or using it while running the game in the Editor. Just use it at different points to analyze what it going on at that time.
Memory profiling in the editor is not recommended because the Editor has some unexpected (and for an issue in the build irrelevant) memory usage patterns.
The Profiler Window’s Memory Profiler Module does not show managed (C#) memory, only native (C/C++). Use the Memory Profiler package to get the full picture, as the managed heap seems to be the biggest chunk after the ExecutavleAndDLL size (and profiling which is irrelevant to your issue).
Where does the text content to your book reside? I assume it’s not in C# files? Are you using Reflection and/or generics? That execuable size is a bit big for mobile so I’m wondering how it comes up to that size. Have you turned on code stripping in your Player settings? Is this a Mono or an IL2CPP build?
With the memory Profiler Package, try taking snapshot e.g. in level 1, 2 and 3 and then compare them to each other, also using the diffing function. See if something sticks around hat shouldn’t and check this guide for finding memory leaks.
Hello Martin,
I tried to make things you said. I hope I have done correctly. My profile analysis data is attached. Unfortunately, I didn’t understand nothing
Test Scenario :
First test was very fast till 50-60 pages and crashed at 128. page
Second test was very slow and I think it crashed at between 70-90 pages.
When I test I clicked next button fastly and again previous button. My app has only text this is why I trought that my app should work fast.
Thank you so much for your support. I am grateful for your help.
I deleted all of app and I created 2020.1.11f but I faced same problem and deleted it. I created in 2019.3.6f again.
I found the problem. I disabled Admob Banner script and my app worked perfectly but I enabled admob banner script again, my app has a performance problem is going slow down and crash. Unfortunately, I couldn’t find a solution. The script I used is standart admob script. When I add banner object every scene and my book app is going very slow down and crash. Could you please give me a suggestion?
I added Google Mobile Ads 5.4.0
My unity version : 2019.3.6f
//public class BannerReklam : MonoBehaviour
//{
// private BannerView bannerView;
// // Start is called before the first frame update
// void Start()
// {
// //Initialize the Google Mobile Ads SDK.
// //MobileAds.Initialize(initStatus => { });
I found solution for admob banner performance problem. If you have a lot of scenes and want to show banner every scenes and if your application is getting slow and crashes because of admob banner the solution link is below. I hope this solution can help you.
My apologies, I hadn’t yet found the time to look at the profiler data.
I’m still glad to hear you found a solution good luck with the game!
Martin