I don't understand how to use profiler with mobile (android)

I can use profiler on Unity Remote with phone connected, but its not reflecting the real framerate and performance of what the actual app is giving me when I play the apk distributed to the phone via google play console internal test.

Unity remote shows a consistent 60fps, but the actual standalone game is noticeably slower. At best it could be like 2fps with PP and my shaders active… possibly around 10fps with that stuff deactivated. How do I actually profile the game as it is running ONLY on the mobile device? Is this possible? If not how am I supposed to measure the performance of my mobile game when what unity profiler is showing me on Unity Remote is vastly different than what the actual game is doing when run by itself?

I have followed the instructions on the documentation… it says to connect to wifi, enable Development Build and Autoconnect Profiler, and then do build and run. I do this, the apk gets built, and nothing happens. Nothing runs until I hit the play button, which I can only assume, is no different than if I had never built the package at all, and just hit the play button to begin with. How does this have anything to do with the phone? Is my build location supposed to be on the phone? My build location is currently a directory on my pc.

I’ve been trying to figure out why I’ve been getting this horrible performance for days, and I just don’t get it. I’m not doing anything expensive here… I’m barely using update loops and when I do, they are for movement using fixedupdate (I’m using rigidbody). I’m object pooling all my projectiles and item drops and even the enemies. None of the models have a lot of tris. There is maybe at most 10k total scene tris at any given time, with everything. Without my custom shaders, no directional lights, just an ambient color, and no shadows I have to be getting max 10fps and I can’t get the profiler working to give me the relevant performance information. In editor and on Unity Remote, GC is virtually nothing… I need to get this profiler running the right way.

My problem is step 4… “When the application launches on the device”. --It doesn’t launch on the device… however, logcat fires up and just repeats the same various messages over and over.

Is this even the right way to profile a mobile app? I just don’t know what the typical workflow looks like for profiling a unity game on mobile for android and I can find zero videos or documentation that explains this process. I’ve watched the Unite now introduction to profiler and as far as I can tell there is nothing specific to testing on mobile.

So if I’m understanding this correctly, if I run a development build app on my android device with my android connected to the pc via usb, I should see profiling data being collected. So I’ve been making builds with this setting, and I’ve been distributing them to my test account on google play for internal testing. I download the build to my phone, play the build while connected to unity editor, but I get nothing in the profiler. The above documentation then goes on to cite the same process mentioned before: connect your phone, check Development Build, Autoconnect Profiler and do a Build and Run. If I do that, I get nothing, just logcat running. No game is played either in editor or on phone. If I download a development build through google play, and run it from the phone with it connected to unity, I also get nothing. I’m just not getting how this is supposed to work or if I’m doing something wrong here…

Turns out, my phone (Blackberry KeyOne) gives you several options when plugging into USB.

Charge and Data, Charge Only, and Boost Mode.

To get it working with Unity, you have to select Charge and Data and then select PTP Mode (for photo transfers). If you select “Transfer Files” (which was what I was doing) instead of Photo transfer mode, it will be detected by Unity and logcat, but it won’t allow you to Build and Run, and this will fail silently (ie, I would still get a Successfully built and ran message in console).

4 Likes