Hello everybody!
I’m trying to install a specific package from batchmode through an editor script with unity 2019.4.0 using a command like this:
"PATH TO EDITOR EXECUTABLE" -quit -batchmode -buildTarget Android -projectPath "PROJECT PATH" -targetBuild Android -logFile "Log.txt" -executeMethod HandlePackages.AddOculusSupport.
If I use the same script from editor “HandlePackages.AddOculusSuppor” the package is successfully added, while in batchmode nothing happens.
I noticed that when I try to add the package from batchmode the log file generated from the execution of the script shows me just one error and none of the debug messages I inserted in the method that should add the package.
The script:
public static class HandlePackages
{
static AddRequest Request;
static RemoveRequest removeRequest;
static string oculus_package = "com.unity.xr.oculus";
static string oculus_pk_version = "@1.3.4";
[MenuItem("Window/Add XR Managment")]
public static void AddOculusSupport()
{
// Add a package to the project
try
{
MakeTheRequestAsync();
}
catch (Exception ex)
{
throw ex;
}
}
public static async void MakeTheRequestAsync()
{
Request = Client.Add(oculus_package+oculus_pk_version);
EditorApplication.update += Progress;
while (Request.IsCompleted)
{
Debug.Log("request not completed");
await Task.Delay(1000);
}
Debug.Log("request done");
}
static void Progress()
{
if (Request.IsCompleted)
{
Debug.Log("Request completed");
if (Request.Status == StatusCode.Success && Request.Result.name.Equals(oculus_package + oculus_pk_version))
{
Debug.Log("Installed: " + Request.Result.packageId);
return;
}
else if (Request.Status == StatusCode.Success)
{
Debug.Log("Installed: " + Request.Result.packageId);
}
else if (Request.Status >= StatusCode.Failure)
Debug.LogError(Request.Error.message);
EditorApplication.update -= Progress;
}
}
While this is the top 2 lines of the Log.txt printed by the CLI
[LicensingClient] ERROR Failed to connect to local IPC
[Licensing::Module] Failed to connect to channel: LicenseClient-myname
I find that I have an error also in the “upm.log” :
[2021-10-06T15:41:29.320Z][INFO] Starting Server
[2021-10-06T15:41:29.331Z][INFO] Server started on port [59408]
[2021-10-06T15:41:38.374Z][ERROR] [Unity Package Manager (Upm)]
Parent process [38216] was terminated
[2021-10-06T15:41:40.330Z][INFO] Resolving dependencies by depth
[2021-10-06T15:41:41.194Z][ERROR] [Unity Package Manager (Upm)]
Parent process [9068] was terminated
I think that must be some problem with the package manager, so I tried out all those things written here Batchmode, how do you write to the console, so the user knows when it is done? with no success (even though I didn’t try to run the script with unity 2020)
EDIT:
I tried to lunch that script also in an empty project with unity 2020.3.13f1 with no success
What else can I do to fix/debug this problem??