How to debug on another (cloud built) platform?

In Unity, my target is iOS, but with Cloud Build I also get an Android app. This is great.
But how do I debug my Android build effectively, without having to switch target in Unity? Because that is time consuming.

With Debug I mean that I want to get the console output just like you get in Xcode on iOS when you run the app.

In my Cloud Build Android settings I have:

  • Development build: on
  • Under Advanced options, I defined a pre-export method name: MyBuildSettings.ApplyDebug

This is a MyBuildSettings.cs script in my project in the Editor folder.

MyBuildSettings.cs:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

public class MyBuildSettings : MonoBehaviour
{
    // Start is called before the first frame update
    public static void ApplyDebug()
    {
        BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();

        // use these options for the first build
        // buildPlayerOptions.options = BuildOptions.Development;

        // use these options for building scripts
        buildPlayerOptions.locationPathName = "Hello";
 
        buildPlayerOptions.options = [COLOR=#ff0000]BuildOptions.AllowDebugging | BuildOptions.Development | BuildOptions.WaitForPlayerConnection[/COLOR];

        BuildPipeline.BuildPlayer(buildPlayerOptions);
    }
}

With this I expect my build to wait for debugger to attach when running it on my Android device.
I also expect to be able to connect to my build in the Unity editor console (see iamge) but it doesnt show up. debug mode is active on my android device.
But it doesn’t wait and just runs. :confused: What am I doing wrong here? I want to debug my build… :slight_smile:

I can’t even make up if this is a dev build, apart from that it is 25% larger than before.


6130013--668318--Screenshot 2020-07-25 at 11.28.05.png

Oh well… I used adb logcat which was sufficient this time.
Still I’d like to learn how to debug Android on Unity, while targeting iOS in the editor. Read for an hour online, still no solution that works.