UnityServices.InitializeAsync failed when switch from Mono to IL2CPP scripting backend.

Hi there, I was adding UnityServices to one of my android games. I’m working with this configuration:

Unity 2021.3.11f1
Scripting Backend: Mono
Api Compatibility Level: .NET Standard 2.1
Min API Level: Android 5.1 ‘Lollipop’ (API level 22)
Target API Level: Authomatic (highest installed) - I have installed Android ‘Tiramisu’ API level 33

Services Core 1.4.2
In App Purchasing: 4.4.1
Analytics: 4.2.0
Authentication 2.1.1

In my script I initialize everything with this:

async void InitializeUnityGamingServices()
{
        string environment = "production";
        try
        {
            var options = new InitializationOptions();
            options.SetEnvironmentName(environment);

            await UnityServices.InitializeAsync(options);

            Debug.Log(UnityServices.State);

            AnalyticsManager.Instance.Init();
            IAPManager.Instance.Init();
            AdManager.Instance.Init();
        }
        catch(Exception exception)
        {
            Debug.Log("Initializing UnityGamingServices failed: " + exception.Message);
            Debug.Log("Initializing UnityGamingServices failed help link: " + exception.HelpLink);
        }
}

Everything works perfect. All my other managers initialize perfect too, I got Analytics, IAP and Ads running good in Editor and also on Android Device.

Now the problem: If I just switch Scripting Backend: Mono to Scripting Backend: IL2CPP then UnityServices.InitializeAsync() fail.

On device reading the Debug.Log output with adb.exe the exception.Message is:

10-09 16:49:23.597 13458 13491 I Unity : Initializing UnityGamingServices failed: Failed to sort tree! It is likely there is a missing required dependency:
10-09 16:49:23.597 13458 13491 I Unity : {
10-09 16:49:23.597 13458 13491 I Unity : “ordered”: [
10-09 16:49:23.597 13458 13491 I Unity : {
10-09 16:49:23.597 13458 13491 I Unity : “packageHash”: 872687088,
10-09 16:49:23.597 13458 13491 I Unity : “packageProvider”: “CorePackageInitializer”,
10-09 16:49:23.597 13458 13491 I Unity : “packageDependencies”: [ ]
10-09 16:49:23.597 13458 13491 I Unity : }
10-09 16:49:23.597 13458 13491 I Unity : ],
10-09 16:49:23.597 13458 13491 I Unity : “packages”: [
10-09 16:49:23.597 13458 13491 I Unity : {
10-09 16:49:23.597 13458 13491 I Unity : “packageHash”: 872588976,
10-09 16:49:23.597 13458 13491 I Unity : “packageProvider”: “Ua2CoreInitializeCallback”,
10-09 16:49:23.597 13458 13491 I Unity : “packageDependencies”: [
10-09 16:49:23.597 13458 13491 I Unity : {
10-09 16:49:23.597 13458 13491 I Unity : “dependencyHash”: 603191216,
10-09 16:49:23.597 13458 13491 I Unity : “dependencyComponent”: “IInstallationId”,
10-09 16:49:23.597 13458 13491 I Unity : “dependencyProvided”: “true”,
10-09 16:49:23.597 13458 13491 I Unity : “dependencyOptional”: “false”
10-09 16:49:23.597 13458 13491 I Unity : },
10-09 16:49:23.597 13458 13491 I Unity : {
10-09 16:49:23.597 13458 13491 I Unity : “dependencyHash”: 603188048,
10-09 16:49:23.597 13458 13491 I Unity : “dependencyComponent”: “ICloudProjectId”,
10-09 16:49:23.597 13458 13491 I Unity : “dependencyProvided”: “true”,
10-09 16:49:23.597 13458 13491 I Unity : “dependencyOptional”: “false”
10-09 16:49:23.597 13458 13491 I Unity : },
10-09 16:49:23.597 13458 13491 I Unity : {
10-09 16:49:23.597 13458 13491 I Unity : “dependencyHash”: 602968400,
10-09 16:49:23.597 13458 13491 I Unity : “dependencyComponent”: “IEnvironments”,
10-09 16:49:23.597 13458 13491 I Unity : “dependencyProvided”: “true”,
10-09 16:49:23.597 13458 13491 I Unity : “dependencyOptional”: “false”
10-09 16:49:23.597 13458 13491 I Unity : },
10-09 16:49:23.597 13458 13491 I Unity : {
10-09 16:49:23.597 13458 13491 I Unity : "dependencyH
10-09 16:49:23.600 13458 13491 I Unity : Initializing UnityGamingServices failed help link:
10-09 16:49:23.600 13458 13491 I Unity : d__27:MoveNext()
10-09 16:49:23.600 13458 13491 I Unity : System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
10-09 16:49:23.600 13458 13491 I Unity : System.Runtime.CompilerServices.MoveNextRunner:Run()
10-09 16:49:23.600 13458 13491 I Unity : System.Threading.Tasks.AwaitTaskContinuation:RunCallback(ContextCallback, Object, Task&)
10-09 16:49:23.600 13458 13491 I Unity : System.Threading.Tasks.Task:FinishContinuations()
10-09 16:49:23.600 13458 13491 I Unity : System.Threading.Tasks.Task:Finish(Boolean)
10-09 16:49:23.600 13458 13491 I Unity : System.Threading.Tasks.Task:TrySetException(Object)
10-09 16:49:23.600 13458 13491 I Unity : System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetException(Exception)
10-09 16:49:23.600 13458 13491 I Unity : Unity.Services.Core.d__11:MoveNext()
10-09 16:49:23.600 13458 13491 I Unity : System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
10-09 16:49:23.600 13458 13491 I Unity : System.Runtime.CompilerServices.MoveNextRunner:Run()
10-09 16:49:23.600 13458 13491 I Unity : System.Threading.Tasks.AwaitTaskContinuation:RunCallback(ContextCallback, Object, Task&)
10-09 16:49:23.600 13458 13491 I Unity : System.Threading.Tasks.Task:FinishContinuations()
10-09 16:49:23.600 13458 13491 I Unity : System.Threading.Tasks.Task:Finish(Boolean)
10-09 16:49:23.600 13458 13491 I Unity : System.Threading.Tasks.Task:TrySetException(Object)
10-09 16:49:23.600 13458 13491 I Unity : Sy

Any idea whats happening and how to solve?
Thanks!

Here is my Packages/manifest file:

{
“dependencies”: {
“com.unity.addressables”: “1.19.19”,
“com.unity.ads”: “4.3.0”,
“com.unity.collab-proxy”: “1.17.2”,
“com.unity.ide.rider”: “3.0.15”,
“com.unity.ide.visualstudio”: “2.0.16”,
“com.unity.ide.vscode”: “1.2.5”,
“com.unity.purchasing”: “4.4.1”,
“com.unity.remote-config”: “3.1.3”,
“com.unity.test-framework”: “1.1.31”,
“com.unity.textmeshpro”: “3.0.6”,
“com.unity.timeline”: “1.6.4”,
“com.unity.ugui”: “1.0.0”,
“com.unity.visualscripting”: “1.7.8”,
“com.unity.modules.ai”: “1.0.0”,
“com.unity.modules.androidjni”: “1.0.0”,
“com.unity.modules.animation”: “1.0.0”,
“com.unity.modules.assetbundle”: “1.0.0”,
“com.unity.modules.audio”: “1.0.0”,
“com.unity.modules.cloth”: “1.0.0”,
“com.unity.modules.director”: “1.0.0”,
“com.unity.modules.imageconversion”: “1.0.0”,
“com.unity.modules.imgui”: “1.0.0”,
“com.unity.modules.jsonserialize”: “1.0.0”,
“com.unity.modules.particlesystem”: “1.0.0”,
“com.unity.modules.physics”: “1.0.0”,
“com.unity.modules.physics2d”: “1.0.0”,
“com.unity.modules.screencapture”: “1.0.0”,
“com.unity.modules.terrain”: “1.0.0”,
“com.unity.modules.terrainphysics”: “1.0.0”,
“com.unity.modules.tilemap”: “1.0.0”,
“com.unity.modules.ui”: “1.0.0”,
“com.unity.modules.uielements”: “1.0.0”,
“com.unity.modules.umbra”: “1.0.0”,
“com.unity.modules.unityanalytics”: “1.0.0”,
“com.unity.modules.unitywebrequest”: “1.0.0”,
“com.unity.modules.unitywebrequestassetbundle”: “1.0.0”,
“com.unity.modules.unitywebrequestaudio”: “1.0.0”,
“com.unity.modules.unitywebrequesttexture”: “1.0.0”,
“com.unity.modules.unitywebrequestwww”: “1.0.0”,
“com.unity.modules.vehicles”: “1.0.0”,
“com.unity.modules.video”: “1.0.0”,
“com.unity.modules.vr”: “1.0.0”,
“com.unity.modules.wind”: “1.0.0”,
“com.unity.modules.xr”: “1.0.0”
}
}

And here ir my Packages/packages-lock file:
{
“dependencies”: {
“com.hovelhouse.cloudkit”: {
“version”: “file:CloudKit”,
“depth”: 0,
“source”: “embedded”,
“dependencies”: {}
},
“com.unity.addressables”: {
“version”: “1.19.19”,
“depth”: 0,
“source”: “registry”,
“dependencies”: {
“com.unity.scriptablebuildpipeline”: “1.19.6”,
“com.unity.modules.assetbundle”: “1.0.0”,
“com.unity.modules.imageconversion”: “1.0.0”,
“com.unity.modules.jsonserialize”: “1.0.0”,
“com.unity.modules.unitywebrequest”: “1.0.0”,
“com.unity.modules.unitywebrequestassetbundle”: “1.0.0”
},
“url”: “https://packages.unity.com
},
“com.unity.ads”: {
“version”: “4.3.0”,
“depth”: 0,
“source”: “registry”,
“dependencies”: {
“com.unity.ugui”: “1.0.0”
},
“url”: “https://packages.unity.com
},
“com.unity.collab-proxy”: {
“version”: “1.17.2”,
“depth”: 0,
“source”: “registry”,
“dependencies”: {
“com.unity.services.core”: “1.0.1”
},
“url”: “https://packages.unity.com
},
“com.unity.ext.nunit”: {
“version”: “1.0.6”,
“depth”: 1,
“source”: “registry”,
“dependencies”: {},
“url”: “https://packages.unity.com
},
“com.unity.ide.rider”: {
“version”: “3.0.15”,
“depth”: 0,
“source”: “registry”,
“dependencies”: {
“com.unity.ext.nunit”: “1.0.6”
},
“url”: “https://packages.unity.com
},
“com.unity.ide.visualstudio”: {
“version”: “2.0.16”,
“depth”: 0,
“source”: “registry”,
“dependencies”: {
“com.unity.test-framework”: “1.1.9”
},
“url”: “https://packages.unity.com
},
“com.unity.ide.vscode”: {
“version”: “1.2.5”,
“depth”: 0,
“source”: “registry”,
“dependencies”: {},
“url”: “https://packages.unity.com
},
“com.unity.nuget.newtonsoft-json”: {
“version”: “3.0.2”,
“depth”: 1,
“source”: “registry”,
“dependencies”: {},
“url”: “https://packages.unity.com
},
“com.unity.purchasing”: {
“version”: “4.4.1”,
“depth”: 0,
“source”: “registry”,
“dependencies”: {
“com.unity.ugui”: “1.0.0”,
“com.unity.modules.unityanalytics”: “1.0.0”,
“com.unity.modules.unitywebrequest”: “1.0.0”,
“com.unity.modules.jsonserialize”: “1.0.0”,
“com.unity.modules.androidjni”: “1.0.0”,
“com.unity.services.core”: “1.3.1”,
“com.unity.services.analytics”: “4.0.1”
},
“url”: “https://packages.unity.com
},
“com.unity.remote-config”: {
“version”: “3.1.3”,
“depth”: 0,
“source”: “registry”,
“dependencies”: {
“com.unity.nuget.newtonsoft-json”: “3.0.2”,
“com.unity.modules.unitywebrequest”: “1.0.0”,
“com.unity.remote-config-runtime”: “3.1.3”
},
“url”: “https://packages.unity.com
},
“com.unity.remote-config-runtime”: {
“version”: “3.1.3”,
“depth”: 1,
“source”: “registry”,
“dependencies”: {
“com.unity.nuget.newtonsoft-json”: “3.0.2”,
“com.unity.modules.unitywebrequest”: “1.0.0”,
“com.unity.modules.unityanalytics”: “1.0.0”,
“com.unity.services.core”: “1.4.0”,
“com.unity.services.authentication”: “2.0.0”
},
“url”: “https://packages.unity.com
},
“com.unity.scriptablebuildpipeline”: {
“version”: “1.20.1”,
“depth”: 1,
“source”: “registry”,
“dependencies”: {},
“url”: “https://packages.unity.com
},
“com.unity.services.analytics”: {
“version”: “4.2.0”,
“depth”: 1,
“source”: “registry”,
“dependencies”: {
“com.unity.ugui”: “1.0.0”,
“com.unity.services.core”: “1.4.0”
},
“url”: “https://packages.unity.com
},
“com.unity.services.authentication”: {
“version”: “2.1.1”,
“depth”: 2,
“source”: “registry”,
“dependencies”: {
“com.unity.nuget.newtonsoft-json”: “3.0.2”,
“com.unity.services.core”: “1.4.2”,
“com.unity.modules.unitywebrequest”: “1.0.0”,
“com.unity.ugui”: “1.0.0”
},
“url”: “https://packages.unity.com
},
“com.unity.services.core”: {
“version”: “1.4.2”,
“depth”: 1,
“source”: “registry”,
“dependencies”: {
“com.unity.modules.unitywebrequest”: “1.0.0”,
“com.unity.nuget.newtonsoft-json”: “3.0.2”,
“com.unity.modules.androidjni”: “1.0.0”
},
“url”: “https://packages.unity.com
},
“com.unity.test-framework”: {
“version”: “1.1.31”,
“depth”: 0,
“source”: “registry”,
“dependencies”: {
“com.unity.ext.nunit”: “1.0.6”,
“com.unity.modules.imgui”: “1.0.0”,
“com.unity.modules.jsonserialize”: “1.0.0”
},
“url”: “https://packages.unity.com
},
“com.unity.textmeshpro”: {
“version”: “3.0.6”,
“depth”: 0,
“source”: “registry”,
“dependencies”: {
“com.unity.ugui”: “1.0.0”
},
“url”: “https://packages.unity.com
},
“com.unity.timeline”: {
“version”: “1.6.4”,
“depth”: 0,
“source”: “registry”,
“dependencies”: {
“com.unity.modules.director”: “1.0.0”,
“com.unity.modules.animation”: “1.0.0”,
“com.unity.modules.audio”: “1.0.0”,
“com.unity.modules.particlesystem”: “1.0.0”
},
“url”: “https://packages.unity.com
},
“com.unity.ugui”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.ui”: “1.0.0”,
“com.unity.modules.imgui”: “1.0.0”
}
},
“com.unity.visualscripting”: {
“version”: “1.7.8”,
“depth”: 0,
“source”: “registry”,
“dependencies”: {
“com.unity.ugui”: “1.0.0”,
“com.unity.modules.jsonserialize”: “1.0.0”
},
“url”: “https://packages.unity.com
},
“com.unity.modules.ai”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.androidjni”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.animation”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.assetbundle”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.audio”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.cloth”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.physics”: “1.0.0”
}
},
“com.unity.modules.director”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.audio”: “1.0.0”,
“com.unity.modules.animation”: “1.0.0”
}
},
“com.unity.modules.imageconversion”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.imgui”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.jsonserialize”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.particlesystem”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.physics”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.physics2d”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.screencapture”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.imageconversion”: “1.0.0”
}
},
“com.unity.modules.subsystems”: {
“version”: “1.0.0”,
“depth”: 1,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.jsonserialize”: “1.0.0”
}
},
“com.unity.modules.terrain”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.terrainphysics”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.physics”: “1.0.0”,
“com.unity.modules.terrain”: “1.0.0”
}
},
“com.unity.modules.tilemap”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.physics2d”: “1.0.0”
}
},
“com.unity.modules.ui”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.uielements”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.ui”: “1.0.0”,
“com.unity.modules.imgui”: “1.0.0”,
“com.unity.modules.jsonserialize”: “1.0.0”,
“com.unity.modules.uielementsnative”: “1.0.0”
}
},
“com.unity.modules.uielementsnative”: {
“version”: “1.0.0”,
“depth”: 1,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.ui”: “1.0.0”,
“com.unity.modules.imgui”: “1.0.0”,
“com.unity.modules.jsonserialize”: “1.0.0”
}
},
“com.unity.modules.umbra”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.unityanalytics”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.unitywebrequest”: “1.0.0”,
“com.unity.modules.jsonserialize”: “1.0.0”
}
},
“com.unity.modules.unitywebrequest”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.unitywebrequestassetbundle”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.assetbundle”: “1.0.0”,
“com.unity.modules.unitywebrequest”: “1.0.0”
}
},
“com.unity.modules.unitywebrequestaudio”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.unitywebrequest”: “1.0.0”,
“com.unity.modules.audio”: “1.0.0”
}
},
“com.unity.modules.unitywebrequesttexture”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.unitywebrequest”: “1.0.0”,
“com.unity.modules.imageconversion”: “1.0.0”
}
},
“com.unity.modules.unitywebrequestwww”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.unitywebrequest”: “1.0.0”,
“com.unity.modules.unitywebrequestassetbundle”: “1.0.0”,
“com.unity.modules.unitywebrequestaudio”: “1.0.0”,
“com.unity.modules.audio”: “1.0.0”,
“com.unity.modules.assetbundle”: “1.0.0”,
“com.unity.modules.imageconversion”: “1.0.0”
}
},
“com.unity.modules.vehicles”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.physics”: “1.0.0”
}
},
“com.unity.modules.video”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.audio”: “1.0.0”,
“com.unity.modules.ui”: “1.0.0”,
“com.unity.modules.unitywebrequest”: “1.0.0”
}
},
“com.unity.modules.vr”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.jsonserialize”: “1.0.0”,
“com.unity.modules.physics”: “1.0.0”,
“com.unity.modules.xr”: “1.0.0”
}
},
“com.unity.modules.wind”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {}
},
“com.unity.modules.xr”: {
“version”: “1.0.0”,
“depth”: 0,
“source”: “builtin”,
“dependencies”: {
“com.unity.modules.physics”: “1.0.0”,
“com.unity.modules.jsonserialize”: “1.0.0”,
“com.unity.modules.subsystems”: “1.0.0”
}
}
}
}

I’d first remove any packages you don’t actually need, and also clear the package cache, then reimport all.

If it still doesn’t work, make a blank empty project, import the packages you want and try to build them for IL2CPP.

If THAT doesn’t build, open a bug report (Help → Report A Bug) from that empty project.

If that DOES work, then bisect from the empty project to your project to see what’s wrong.

Extra unwanted packages in new projects (collab, testing, rider and other junk):

About the fastest way I have found to make a project and avoid all this noise is to create the project, then as soon as you see the files appear, FORCE-STOP (hard-kill) Unity (with the Activity Manager or Task Manager), then go hand-edit the Packages/manifest.json file as outlined in the above post, then reopen Unity.

Sometimes the package system gets borked from all this unnecessary churn and requires the package cache to be cleared:

Hi Kurt-Dekker.
“I’d first remove any packages you don’t actually need, and also clear the package cache, then reimport all.”
Done. Same issue. With Mono work good, with IL2CPP dont work.

“If it still doesn’t work, make a blank empty project, import the packages you want and try to build them for IL2CPP.”
Done. In a blank empty project, after importing the packages that im using calling await UnityServices.InitializeAsync(options); works good. I dont have any exception.

Im also tried from Package Manager, clicking on Reset Packages to Default. And then a lot of errors by my scripts that dont find the references to the packages that im using, but added that packages by hand editing Packages/manifest.json. Errors from my scripts gone. I can compile. But the issue with UnityServices.InitializeAsync(options); continue.

Then, I checked one by one every package in Package Manager, from the blank project and my current problematic project. Im ensure that them all are the same. Same versions too. Just one custom package is not in the blank project, but is a Custom package for iOS:
com.hovelhouse.cloudkit, version 1.1.9.
But I dont think that this package is causing the problem.

What do you suggest to do? Im thinking on copy & paste Packages/manifest.json and Packages/packages-lock.json files from the blank empty project to mi problematic project. Then do again the clearing package cache method removing all from C:\Users\myuser\AppData\Local\Unity\cache\packages and in Unity doing Assets/Reimport All.

Do you think its safe to do? (making backups to that files, also have all in git).

Try diff the ProjectSettings.asset file between the two projects.

You could look at diffs in other files in the ProjectSettings/ folder too. There’s probably one (or more) for services. I bet you’ll find a critical change between the two.

I’ve seen issues with older properties “hanging around,” even ones that can no longer be edited in the version of Unity you’re using. The specific instance I saw on this was a long-deprecated “mobile fog” field that got set to false and over-rode my regular fog in a later version of Unity (in my oldest game, of course, one started in Unity3.3) that was no longer able to edit that field. Wouldn’t be surprised if there was something like that.

I’d drop your entire /Assets folder into the new empty project. If that continues to function, then drop the ProjectSettings folder in… at least that bisects between project guts and project settings.

Well… not fixed yet. So far, I made this:

  1. Created blank empty project.
  2. Added the packages that I need, from Window/Packages Manager. (Addressabless, Advertisement, Analytics, Authentication, Remote Config, In App Purchasing).
  3. Imported GooglePlayGames package, GooglePlayGamesPlugin-0.11.01.
  4. Set Scripting backend to IL2CPP.
  5. Configured Unity Gaming Services, added my credit card on Unity Dashboard.
  6. Configured Google Play Services in Google console, singed the app and everything of that stuff.
  7. Created a empty scene, with one game object with one script that call UnityServices.InitializeAsync(options);
  8. Builded for my android device. Tested on it: UnityServices.InitializeAsync runs perfect. It initialized.

  1. Copied all of my game Asset folder (omitting ExternalDependencyManager, Plugins, and Resources folders) to this blank empty project.
  2. Game runs fine in editor.
  3. Builded the game for my android device. Tested on it: UnityServices.InitializeAsync results in the same exception.

Failed to sort tree! It is likely there is a missing required dependency:
10-10 00:50:33.860 7152 7172 I Unity : System.Runtim
10-10 00:50:33.862 7152 7172 I Unity : Failed to sort tree! It is likely there is a missing required dependency:
10-10 00:50:33.862 7152 7172 I Unity : {
10-10 00:50:33.862 7152 7172 I Unity : “ordered”: [
10-10 00:50:33.862 7152 7172 I Unity : {
10-10 00:50:33.862 7152 7172 I Unity : “packageHash”: 872126192,
10-10 00:50:33.862 7152 7172 I Unity : “packageProvider”: “CorePackageInitializer”,
10-10 00:50:33.862 7152 7172 I Unity : “packageDependencies”: [ ]
10-10 00:50:33.862 7152 7172 I Unity : }
10-10 00:50:33.862 7152 7172 I Unity : ],
10-10 00:50:33.862 7152 7172 I Unity : “packages”: [
10-10 00:50:33.862 7152 7172 I Unity : {
10-10 00:50:33.862 7152 7172 I Unity : “packageHash”: 872060336,
10-10 00:50:33.862 7152 7172 I Unity : “packageProvider”: “Ua2CoreInitializeCallback”,
10-10 00:50:33.862 7152 7172 I Unity : “packageDependencies”: [
10-10 00:50:33.862 7152 7172 I Unity : {
10-10 00:50:33.862 7152 7172 I Unity : “dependencyHash”: 602831824,
10-10 00:50:33.862 7152 7172 I Unity : “dependencyComponent”: “IInstallationId”,
10-10 00:50:33.862 7152 7172 I Unity : “dependencyProvided”: “true”,
10-10 00:50:33.862 7152 7172 I Unity : “dependencyOptional”: “false”
10-10 00:50:33.862 7152 7172 I Unity : },
10-10 00:50:33.862 7152 7172 I Unity : {
10-10 00:50:33.862 7152 7172 I Unity : “dependencyHash”: 602892368,
10-10 00:50:33.862 7152 7172 I Unity : “dependencyComponent”: “ICloudProjectId”,
10-10 00:50:33.862 7152 7172 I Unity : “dependencyProvided”: “true”,
10-10 00:50:33.862 7152 7172 I Unity : “dependencyOptional”: “false”
10-10 00:50:33.862 7152 7172 I Unity : },
10-10 00:50:33.862 7152 7172 I Unity : {
10-10 00:50:33.862 7152 7172 I Unity : “dependencyHash”: 602868432,
10-10 00:50:33.862 7152 7172 I Unity : “dependencyComponent”: “IEnvironments”,
10-10 00:50:33.862 7152 7172 I Unity : “dependencyProvided”: “true”,
10-10 00:50:33.862 7152 7172 I Unity : “dependencyOptional”: “false”
10-10 00:50:33.862 7152 7172 I Unity : },
10-10 00:50:33.862 7152 7172 I Unity : {
10-10 00:50:33.862 7152 7172 I Unity : “dependencyHash”: 602826896,
10-10 00:50:33.862 7152 7172 I Unity : “dependencyComponent”: "IPro

So… it is something that are in my Asset folder? What could it be?

I think you just need to keep bisecting… next up try deleting ALL files in any folders called Editor … it might be a misconfigured build step script or other editor script.

Got it working now. I think it was a deprecated Remote Config code. I was using the old: using Unity.RemoteConfig;
Changed to: using Unity.Services.RemoteConfig;

Now its working.

Thanks Kurt!

3 Likes

You saved me and my team.
Long live KaOzz!

1 Like