Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

How to debug on another (cloud built) platform?

Discussion in 'Unity Build Automation' started by John1515, Jul 23, 2020.

  1. John1515

    John1515

    Joined:
    Nov 29, 2012
    Posts:
    249
    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.
     
  2. John1515

    John1515

    Joined:
    Nov 29, 2012
    Posts:
    249
    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:

    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using UnityEditor;
    6.  
    7. public class MyBuildSettings : MonoBehaviour
    8. {
    9.     // Start is called before the first frame update
    10.     public static void ApplyDebug()
    11.     {
    12.         BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
    13.  
    14.         // use these options for the first build
    15.         // buildPlayerOptions.options = BuildOptions.Development;
    16.  
    17.         // use these options for building scripts
    18.         buildPlayerOptions.locationPathName = "Hello";
    19.  
    20.         buildPlayerOptions.options = [COLOR=#ff0000]BuildOptions.AllowDebugging | BuildOptions.Development | BuildOptions.WaitForPlayerConnection[/COLOR];
    21.  
    22.         BuildPipeline.BuildPlayer(buildPlayerOptions);
    23.     }
    24. }
    25.  
    26.  

    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. :/ What am I doing wrong here? I want to debug my build.. :)

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

    Attached Files:

  3. John1515

    John1515

    Joined:
    Nov 29, 2012
    Posts:
    249
    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.