Search Unity

NullReferenceException when entering play mode or building

Discussion in 'Addressables' started by zvinless, Jun 21, 2019.

  1. zvinless

    zvinless

    Joined:
    Oct 6, 2014
    Posts:
    17
    NullReferenceException: Object reference not set to an instance of an object UnityEditor.AddressableAssets.Settings.AddressableAssetEntry.CreateCatalogEntries (System.Collections.Generic.List`1[T] entries, System.Boolean isBundled, System.String providerType, System.Collections.Generic.IEnumerable`1[T] deps, System.Object extraData) (at Library/PackageCache/com.unity.addressables@1.1.3-preview/Editor/Settings/AddressableAssetEntry.cs:478) UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptBase.CreateLocationsForPlayerData (UnityEditor.AddressableAssets.Settings.GroupSchemas.PlayerDataGroupSchema playerDataSchema, UnityEditor.AddressableAssets.Settings.AddressableAssetGroup assetGroup, System.Collections.Generic.List`1[T] locations) (at Library/PackageCache/com.unity.addressables@1.1.3-preview/Editor/Build/DataBuilders/BuildScriptBase.cs:144) UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode.ProcessPlayerDataSchema (UnityEditor.AddressableAssets.Settings.GroupSchemas.PlayerDataGroupSchema schema, UnityEditor.AddressableAssets.Settings.AddressableAssetGroup assetGroup, UnityEditor.AddressableAssets.Build.DataBuilders.AddressableAssetsBuildContext aaContext) (at Library/PackageCache/com.unity.addressables@1.1.3-preview/Editor/Build/DataBuilders/BuildScriptPackedMode.cs:235)


    I get this error whenever I enter play mode or try to build on 1.1.3 and 1.1.4, which doesn't seem to affect playing in the editor but does cause builds to fail. I'm not sure what might be causing my project to get into a state where the error occurs, deleting my Library folder resolves the issue. Obviously some object returned from AssetDatabase.LoadAllAssetRepresentationsAtPath(AssetPath); is null, but I'm not familiar with that API.
     
  2. Birkeman

    Birkeman

    Joined:
    Apr 22, 2013
    Posts:
    18
    I'm getting a similar error in play mode. If I hit Build->Build Player Content I also get this error:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.AddressableAssets.Settings.AddressableAssetEntry.CheckForEditorAssembly (System.Type& t, System.String internalId) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Settings/AddressableAssetEntry.cs:499)
    UnityEditor.AddressableAssets.Settings.AddressableAssetEntry.CreateCatalogEntries (System.Collections.Generic.List`1[T] entries, System.Boolean isBundled, System.String providerType, System.Collections.Generic.IEnumerable`1[T] deps, System.Object extraData) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Settings/AddressableAssetEntry.cs:471)
    UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptBase.CreateLocationsForPlayerData (UnityEditor.AddressableAssets.Settings.GroupSchemas.PlayerDataGroupSchema playerDataSchema, UnityEditor.AddressableAssets.Settings.AddressableAssetGroup assetGroup, System.Collections.Generic.List`1[T] locations) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptBase.cs:144)
    UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode.ProcessPlayerDataSchema (UnityEditor.AddressableAssets.Settings.GroupSchemas.PlayerDataGroupSchema schema, UnityEditor.AddressableAssets.Settings.AddressableAssetGroup assetGroup, UnityEditor.AddressableAssets.Build.DataBuilders.AddressableAssetsBuildContext aaContext) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptPackedMode.cs:235)
    UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode.ProcessGroupSchema (UnityEditor.AddressableAssets.Settings.AddressableAssetGroupSchema schema, UnityEditor.AddressableAssets.Settings.AddressableAssetGroup assetGroup, UnityEditor.AddressableAssets.Build.DataBuilders.AddressableAssetsBuildContext aaContext) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptPackedMode.cs:223)
    UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode.ProcessGroup (UnityEditor.AddressableAssets.Settings.AddressableAssetGroup assetGroup, UnityEditor.AddressableAssets.Build.DataBuilders.AddressableAssetsBuildContext aaContext) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptPackedMode.cs:202)
    UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptBase.ProcessAllGroups (UnityEditor.AddressableAssets.Build.DataBuilders.AddressableAssetsBuildContext aaContext) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptBase.cs:96)
    UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode.BuildDataImplementation[TResult] (UnityEditor.AddressableAssets.Build.AddressablesDataBuilderInput builderInput) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptPackedMode.cs:84)
    UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptBase.BuildData[TResult] (UnityEditor.AddressableAssets.Build.AddressablesDataBuilderInput builderInput) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptBase.cs:60)
    UnityEditor.AddressableAssets.Settings.AddressableAssetSettings.BuildPlayerContentImpl () (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Settings/AddressableAssetSettings.cs:1613)
    UnityEditor.AddressableAssets.Settings.AddressableAssetSettings.BuildPlayerContent () (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Settings/AddressableAssetSettings.cs:1595)
    UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.OnBuildPlayerData () (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:239)
    UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, System.Int32 selected) (at C:/buildslave/unity/build/Editor/Mono/GUI/GenericMenu.cs:121)


    I have two assets in a custom local group.
     
  3. Birkeman

    Birkeman

    Joined:
    Apr 22, 2013
    Posts:
    18
    Update: I got it working with the 0.8.6 package in 2018.3.7f1
     
  4. wtksana_unity

    wtksana_unity

    Joined:
    Nov 1, 2018
    Posts:
    1
    my project update package from 0.8.6 to 1.1.4
    got same problem
     
  5. Mandarb

    Mandarb

    Joined:
    Oct 25, 2017
    Posts:
    3
    Same here
     
  6. hugebug

    hugebug

    Joined:
    Jun 10, 2015
    Posts:
    16
    Same here.
    The same code builds well on iOS, but failed with the error on building Android
     
  7. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    283
    Same error
     
  8. UDN_fae632a8-38d8-4a02-aea5-a51354265256

    UDN_fae632a8-38d8-4a02-aea5-a51354265256

    Joined:
    Apr 18, 2017
    Posts:
    1
    Deleting the Library folder solved this error for me. I had just updated from 0.8.6 to 1.1.4
     
  9. Konstantin_Playtino

    Konstantin_Playtino

    Joined:
    May 2, 2019
    Posts:
    5
  10. xKosta

    xKosta

    Joined:
    Oct 15, 2014
    Posts:
    22
    Hi everyone, small update, this error occures only if you have files (prefabs) with missing script, see the image. I am pretty sure that this caused the issue, also debugger helped me to find the assets. Now I am facing a different problem, "Invalid IL code in ...". Version 1.1.4 seems to be not stable.
     

    Attached Files:

  11. AndersonDev

    AndersonDev

    Joined:
    Dec 13, 2015
    Posts:
    70
    The same, guys may you fix this?) Thanks!

    upload_2019-7-11_15-36-0.png
     
  12. xKosta

    xKosta

    Joined:
    Oct 15, 2014
    Posts:
    22
    Attach the Debugger and just walk back the call stack, one step or so. There will be a sceneasset and the corresponding path. Check the file, probably it has a missing Script.
     
  13. AndersonDev

    AndersonDev

    Joined:
    Dec 13, 2015
    Posts:
    70
    Ye, the problem was: in build settings was added a scene which no longer exists in project.
     
    xKosta likes this.
  14. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    849
    Thanks for tracking this down. I've made a ticket for us to put in guards against this.
     
  15. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    756
    How do you guys find the prefab that is causing this? What is the Debugger?
     
  16. AndersonDev

    AndersonDev

    Joined:
    Dec 13, 2015
    Posts:
    70
    I have used Rider with debugger enabled. Additionally I have enabled "Any Exeption" breakpoint.
     
    joshcamas likes this.
  17. zhengying

    zhengying

    Joined:
    Nov 21, 2015
    Posts:
    12
    I have same problem! Version 1.1.5. no missing script.
    how to resolve it.
     
  18. Beardshaker

    Beardshaker

    Joined:
    Nov 3, 2014
    Posts:
    4
    Had similiar issues, when my groups contained filetypes that are not supported by AssetBundles (like .txt files in our case). Double check if you accidentially got some of those in, for example by marking a whole folder for being addressable.
     
  19. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    849
    This should be fixed with 1.1.7 which will be out soon. If not, please let us know (with some additional details).

    Good point, we should make a check to ensure that builds correctly. Thanks for the tip.