-1
\$\begingroup\$

I have developed an app with Unity 5.2 for the Android platform. The app is running perfectly, but it's loading time is about 7 to 10 seconds, at least, on my Samsung S5.

The first scene that takes time to load contains 6 canvases for different UI purposes. It is mandatory for me to retain these 6 canvases, as my code relies on them. I can't go back from here.

How do I check the performance of my apk, and find the source of my problem?

\$\endgroup\$
  • \$\begingroup\$ So, what exactly is your problem? \$\endgroup\$ – Aditya Yadav May 2 '17 at 6:08
  • \$\begingroup\$ do canvas effect performance ? \$\endgroup\$ – Muhammad Faizan Khan May 2 '17 at 6:09
  • \$\begingroup\$ They do. But to check if it is really affecting your game's performance, try running the game with profiler. \$\endgroup\$ – Aditya Yadav May 2 '17 at 6:14
  • \$\begingroup\$ apk with profiler? \$\endgroup\$ – Muhammad Faizan Khan May 2 '17 at 6:18
  • \$\begingroup\$ No. Run you game on your the device with Development Build and Autoconnect Profiler options checked in the build settings. @Spectre has given a more detailed and step by step answer. \$\endgroup\$ – Aditya Yadav May 2 '17 at 6:45
4
\$\begingroup\$

Canvas affects performance, but not as much as particles, wrong shaders and too many graphics. If the loading time is >7 - profiler is the best option, because you probably have some RAM/draw problems.

From Unity Forums:

  • Make sure to disable Mobile Data on your Android device.
  • Connect your Android device to your WiFi network.
  • Check the "Autoconnect Profiler" checkbox in Unity's build settings dialog.
  • Attach your device to your Mac/PC via cable and hit "Build & Run" in Unity Editor.
  • When the app launches on the device, open the profiler window in Unity Editor (Window->Profiler)
  • If the Unity Editor fails to autoconnect to the device, select the appropriate device from the Profiler Window Active Profiler drop down menu.
\$\endgroup\$
  • \$\begingroup\$ i am trying your answer and during build it is pushing new content to device xyz. from last 5 minutes \$\endgroup\$ – Muhammad Faizan Khan May 2 '17 at 7:01
  • \$\begingroup\$ YES MY QUESTION IS ABOUT CHECKING PERFORMANCE DID YOU RED MY FIRST COMMENT ? \$\endgroup\$ – Muhammad Faizan Khan May 2 '17 at 9:09
  • 2
    \$\begingroup\$ @MohammadFaizanKhan Please watch your caps. This looks like you're yelling at the user and can be considered rude. \$\endgroup\$ – Vaillancourt May 2 '17 at 10:46
  • \$\begingroup\$ @AlexandreVaillancourt i delete that comments but cap doesnt mean that i am yelling or rude. \$\endgroup\$ – Muhammad Faizan Khan May 2 '17 at 10:52
  • \$\begingroup\$ @MohammadFaizanKhan I believe you, and I'm sure it was a mistake :) It's just that it is often interpreted as such in 'written culture' and should best be avoided on a site like this one! Specially when other users can't correct it (other users can edit question and answers to fix it, but not the comments). \$\endgroup\$ – Vaillancourt May 2 '17 at 10:58
1
\$\begingroup\$

There's more than one way to go about testing performance of your game but you usually want to use the Unity's built-in profiler, which has a manual here.

This allows you to see how much of each resources your game is using. You need to dive into the details below and see what's using what, and then optimize by working around the problems or optimizing your code if necessary.

Now, the first way to use the profiler is to just run the game on your computer and look at the results there. This will probably not be very useful by itself since your CPU is probably (and hopefully) much more powerful than your phone's or tablet's. So, you need to limit the CPUs that Unity uses while testing (don't forget to let Unity use all of them when you're done testing). This method is usually much faster than the second one.

The second method would be to use your phone. Either connect your phone to your computer and just use the build and run option Unity provides or send the APK to your phone, install the game and then connect your phone to your computer, then use the profiler to connect to your device. Both will let you test the performance of your game but both are slower to test the performance (in terms of the time it takes from "ready to test the game" to "actually testing the game") than the first method, which allows you to stop the program and then start it again without waiting for a build and an APK installation.

\$\endgroup\$
  • \$\begingroup\$ Have you actually checked out the first two links that I provided? Unity does a pretty good job of explaining what does what in their own profiler. @Gnemlock \$\endgroup\$ – John Hamilton May 2 '17 at 13:26
  • \$\begingroup\$ I have, but I do not judge answers based off links. They are helpful, but not in regards to the static value of an answer. \$\endgroup\$ – Gnemlock May 2 '17 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.