hippogamesunity / HeroEditorHub

Support for Hero Editor assets
18 stars 0 forks source link

Refreshing Icon Collection Regex Does Not Match Anything #185

Closed newcreativegamer closed 1 year ago

newcreativegamer commented 1 year ago

Hi,

I refreshed the Icon collection and nothing passed the regex Line 38 of IconCollection.cs: var match = Regex.Match(path, @"Assets\/HeroEditor\/(?<Edition>\w+)\/(.+?\/)*Icons\/WithoutBackground\/\w+\/(?<Type>\w+)\/(?<Collection>.+?)\/(.+\/)*(?<Name>.+?)\.png");

Any ideas what's wrong?

newcreativegamer commented 1 year ago

As a workaround for now, I reverted that to your old version:

`public void Refresh() { Icons.Clear();

        foreach (var folder in IconFolders)
        {
            if (folder == null) continue;

            var root = AssetDatabase.GetAssetPath(folder);
            var files = Directory.GetFiles(root, "*.png", SearchOption.AllDirectories).ToList();

            foreach (var file in files)
            {
                var sprite = UnityEditor.AssetDatabase.LoadAssetAtPath<Sprite>(file);
                var icon = new ItemIcon { Id = sprite.name, Sprite = sprite };

                if (Icons.Any(i => i.Id == icon.Id))
                {
                    Debug.LogErrorFormat("Duplicated icon id: {0}", icon.Id);
                }
                else
                {
                    Icons.Add(icon);
                }
            }
        }

        Icons = Icons.OrderBy(i => i.Id).ToList();
        EditorUtility.SetDirty(this);
    }`
hippogamesunity commented 1 year ago

Hello! No. IconCollection refresh works fine with the latest asset version.

newcreativegamer commented 1 year ago

image Exception: Incorrect path: Assets/HeroEditor/Common/Icons/BodyParts/Beard/Basic/Beard1.png Assets.HeroEditor.Common.Scripts.Collections.IconCollection.Refresh () (at Assets/HeroEditor/Common/Scripts/Collections/IconCollection.cs:40) Assets.HeroEditor.Common.Scripts.Editor.IconCollectionEditor.OnInspectorGUI () (at Assets/HeroEditor/Common/Scripts/Editor/IconCollectionEditor.cs:22) UnityEditor.UIElements.InspectorElement+<>c__DisplayClass71_0.b__0 () (at <9dccbc75b8a249d78358fb192f335670>:0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

newcreativegamer commented 1 year ago

I'm on 7.1

hippogamesunity commented 1 year ago

The latest version is 7.2. Check this with clean asset setup to a new empty project.

newcreativegamer commented 1 year ago

Works in 7.2, cheers