Hi,
I’m trying to make a build on Android.
It failed, but logs suggested to build addressables first.
I’ve found the solution here .
So I clicked on Window -> Asset Management -> Addressables -> Groups -> Build -> New Default build, but it failed with the following error:
InvalidCastException: Specified cast is not valid.
UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode.DoBuild[TResult] (UnityEditor.AddressableAssets.Build.AddressablesDataBuilderInput builderInput, UnityEditor.AddressableAssets.Build.DataBuilders.AddressableAssetsBuildContext aaContext) (at Library/PackageCache/com.unity.addressables@1.16.6/Editor/Build/DataBuilders/BuildScriptPackedMode.cs:235)
UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode.BuildDataImplementation[TResult] (UnityEditor.AddressableAssets.Build.AddressablesDataBuilderInput builderInput) (at Library/PackageCache/com.unity.addressables@1.16.6/Editor/Build/DataBuilders/BuildScriptPackedMode.cs:77)
UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptBase.BuildData[TResult] (UnityEditor.AddressableAssets.Build.AddressablesDataBuilderInput builderInput) (at Library/PackageCache/com.unity.addressables@1.16.6/Editor/Build/DataBuilders/BuildScriptBase.cs:84)
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings.BuildPlayerContentImpl () (at Library/PackageCache/com.unity.addressables@1.16.6/Editor/Settings/AddressableAssetSettings.cs:1898)
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings.BuildPlayerContent () (at Library/PackageCache/com.unity.addressables@1.16.6/Editor/Settings/AddressableAssetSettings.cs:1880)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.OnBuildPlayerData () (at Library/PackageCache/com.unity.addressables@1.16.6/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:280)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.OnBuildScript (System.Object context) (at Library/PackageCache/com.unity.addressables@1.16.6/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:275)
UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[ ] options, System.Int32 selected) (at /Users/bokken/buildslave/unity/build/Editor/Mono/GUI/GenericMenu.cs:119)
VSCode pointed to this line:
foreach (var r in results.WriteResults)
{
var resultValue = r.Value;
m_Linker.AddTypes(resultValue.includedTypes);
#if UNITY_2021_1_OR_NEWER
// Uncomment once PR 113067 lands in trunk.
//m_Linker.AddSerializedClass(resultValue.includedSerializeReferenceFQN);
#else
if (resultValue.GetType().GetProperty("includedSerializeReferenceFQN") != null)
/* >>> EXCEPTION >>> */ m_Linker.AddSerializedClass((string[])resultValue.GetType().GetProperty("includedSerializeReferenceFQN").GetValue(resultValue));
#endif
}
Is it a bug in localization package or perhaps a problem with my configuration ?
I have never seen that error before. Have you tried updating to the latest version of Addressables?
1 Like
Oh…
I really thought I have everything up to date,
but it turned out that package manager doesn’t notify about possible packages dependencies updates.
I’ve updated Addressables from 1.16.6 to 1.16.15 and it worked.
Thanks.
2 Likes
Hi, same error, same issue, localization 0.9.0 target 1.16.6, so the package manager said I was up to date, but it was not the case.
paradizIsCool:
Hi, same error, same issue, localization 0.9.0 target 1.16.6, so the package manager said I was up to date, but it was not the case.
Did updating fix it for you?
Update to 1.16.15 fixed the issue yes
2 Likes
I had the exact same issue. Addressables version 1.16.6 was used, but Unity wouldn’t tell me, that there is a newer version.
I guess, this happens, because addressables is only a transitive dependency (of localization in my case). Adding addressables explicitly solved the issue for me.
1 Like
magnetic_scho:
I had the exact same issue. Addressables version 1.16.6 was used, but Unity wouldn’t tell me, that there is a newer version.
I guess, this happens, because addressables is only a transitive dependency (of localization in my case). Adding addressables explicitly solved the issue for me.
Yeah, it uses the version the Localization package specifies at its minimum dependency. We have increased this version so that it will automatically update in 0.10.0 but its always a good idea to manually update it yourself if you encounter any issues.