Search Unity

(Case 1122337) AddressableAssetSettings.BuildPlayerContent(); fails with InvalidCastException

Discussion in 'Addressables' started by MNNoxMortem, Jan 30, 2019.

  1. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    This is a new one. Have not seen that yet.
    Code (CSharp):
    1. InvalidCastException: Specified cast is not valid.
    2. (wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr)
    3. UnityEditor.AddressableAssets.BuildScriptPackedPlayMode.BuildData[T] (UnityEditor.AddressableAssets.IDataBuilderContext context) (at Library/PackageCache/com.unity.addressables@0.5.3-preview/Editor/Build/DataBuilders/BuildScriptPackedPlayMode.cs:36)
    4. UnityEditor.AddressableAssets.AddressableAssetSettings.BuildPlayerContent () (at Library/PackageCache/com.unity.addressables@0.5.3-preview/Editor/Settings/AddressableAssetSettings.cs:1307)
    5. UnityEditor.AddressableAssets.AddressableAssetsSettingsGroupEditor.OnBuildPlayerData () (at Library/PackageCache/com.unity.addressables@0.5.3-preview/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:224)
    6. UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, System.Int32 selected) (at C:/buildslave/unity/build/Editor/Mono/GUI/GenericMenu.cs:121)
    7.  
    Thrown by
    Code (CSharp):
    1. AddressableAssetSettings.BuildPlayerContent();
    Happens also when executed from the UI. Unable to build now. Also tryied Clean All to see if it is a caching problem.

    Edit: Found it. This happens when the BuildModeScript is null (setting it to an index not available). Might be helpful to throw an IndexOutOfBoundsException.

    Update: Once broken it will fail until you use clean build. So you need to set a correct builder, then clean, then build again.
     
    Last edited: Jan 30, 2019
    SteveFoxx likes this.