Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException: Object reference not set to an instance of an object #18

Closed
yingnierxiao opened this issue Apr 2, 2020 · 3 comments
Labels

Comments

@yingnierxiao
Copy link

yingnierxiao commented Apr 2, 2020

NullReferenceException: Object reference not set to an instance of an object
AddressableImporter.TryGetGroup (UnityEditor.AddressableAssets.Settings.AddressableAssetSettings settings, System.String groupName, UnityEditor.AddressableAssets.Settings.AddressableAssetGroup& group) (at Library/PackageCache/com.littlebigfun.addressable-importer@f564f851e878451810706be41f31f6018b19571e/Editor/AddressableImporter.cs:142)
AddressableImporter.CreateOrUpdateAddressableAssetEntry (UnityEditor.AddressableAssets.Settings.AddressableAssetSettings settings, AddressableImportSettings importSettings, AddressableImportRule rule, System.String assetPath) (at Library/PackageCache/com.littlebigfun.addressable-importer@f564f851e878451810706be41f31f6018b19571e/Editor/AddressableImporter.cs:70)
AddressableImporter.OnPostprocessAllAssets (System.String[] importedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetPaths) (at Library/PackageCache/com.littlebigfun.addressable-importer@f564f851e878451810706be41f31f6018b19571e/Editor/AddressableImporter.cs:32)
@favoyang favoyang changed the title error NullReferenceException: Object reference not set to an instance of an object Apr 2, 2020
@favoyang
Copy link
Owner

favoyang commented Apr 2, 2020

@yingnierxiao,

Thanks for reporting the issue. The issue is pointed to line 142 of AddressabelImporter.cs

    static bool TryGetGroup(AddressableAssetSettings settings, string groupName, out AddressableAssetGroup group)
    {
        if (string.IsNullOrWhiteSpace(groupName))
        {
            group = settings.DefaultGroup;
            return true;
        }
===>   return ((group = settings.groups.Find(g => string.Equals(g.Name, groupName.Trim()))) == null) ? false : true;
    }

It seems either the settings is null, or the settings.groups is null or settings.groups contains an null element. But I can not reproduce the issue, could you? Or maybe you can try adding a few lines before line 142 to debug?

        Debug.Log("settings: " + settings);
        Debug.Log("settings.groups: " + settings.groups);
        for (int i = 0; i < settings.groups.Count; i++)
        {
            Debug.LogFormat("settings.groups[{0}]: {1}", i, settings.groups[i]);
        }

@yingnierxiao
Copy link
Author

yingnierxiao commented Apr 3, 2020

if you del AddressableAssetSettings.asset ,need filter this file

github-actions bot pushed a commit that referenced this issue Apr 4, 2020
## [0.5.3](v0.5.2...v0.5.3) (2020-04-04)

### Bug Fixes

* check existence of addressables settings (close: [#18](#18)) ([aab0156](aab0156))
@github-actions
Copy link

github-actions bot commented Apr 4, 2020

🎉 This issue has been resolved in version 0.5.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants