WooshiiDev / HierarchyDecorator

Lightweight Unity Plugin transforming the Hierarchy into what it should be. Adds headers, styles, icons and more.
MIT License
1.04k stars 50 forks source link

Settings file creates new asset if moved #13

Closed MostHated closed 4 years ago

MostHated commented 4 years ago

Heya again, I just thought of this because I just ran across it again. I would say this is more of a nuisance probably than a bug, but if you try to relocate the HierarchyDecorator folder from Asset/HierarchyDecorator to something like Assets/Standard Assets/HierarchyDecorator, or anywhere at all aside from just Assets/ it will automatically create a new Asset/HierarchyDecorator/Settings.asset and reference that. I am guessing that it is hardcoded for that path as even if I try to take my old settings file that I had a bunch of changes in, delete the new one and move my old one there, it will just create a new one again right away. So then I had to recreate all my settings, and I was stuck with a standalone file within the Asset/HierarchyDecorator folder when I wanted the whole thing moved to a subfolder.

The separation of the main files from the settings file is really only a concern since I have the actual files in the project instead of added as a package, but being able to move the settings file/folder is definitely something most folks like to do. I try to keep my top level folder clean and put third party assets and what not in the /Standard Assets/ folder.

Should you be interested, I came up with a decent way to handle this a while back that I have used in a few projects and it has done pretty well for me. Here is a link to my settings ScriptableObject, then I just have my main static class check the location of the settings object and update its location.

It kicks off here. https://github.com/instance-id/AboveAverageInspector/blob/16c8295c6317ee11c8e1d947020ca9f7e9962504/Assets/instance.id/Scripts/idConfig.cs#L92

and here is where it determines it's path. https://github.com/instance-id/AboveAverageInspector/blob/16c8295c6317ee11c8e1d947020ca9f7e9962504/Assets/instance.id/Scripts/System/AAIConfiguration.cs#L192

Now that I think about it though, I am not quite sure how it will react when it is located in a package. It may end up not being useful at all, actually, lol. I may have to make some adjustments once I actually go that route and test it out.

Thanks, -MH

WooshiiDev commented 4 years ago

Hey there MostHated, I apologize for the lack of content or versions for this, been more busy than expected. So I've setup settings to now be free to be moved anywhere in the project.

This was on the cards to be fixed for a while and I knew it really had to change.

You made a good point of packages too in which I personally wasn't sure how it handles them. So settings are stored locally within your assets rather than packages. I don't see any problem with this currently, unless they really should be within the package.

I've set it up to:

This will be part of the next push along with some other changes

I'll keep this comment open for now, just in case are still not working to some degree after the push

WooshiiDev commented 4 years ago

I'm assuming this is all working now, so I'm going to close this, but if any problems come up again I'll reopen it if required

WooshiiDev commented 4 years ago

It's been discovered that when this is installed via packages, it'll not recreate settings, making a fix for the next push

WooshiiDev commented 4 years ago

Actually, after further testing, it does seem to work fine, and was potentially due to there being settings within the package itself I'm going to handle default settings with the next push by storing into JSON then parsing back to a settings instance if one is deleted. This way the default settings as they are right now can be updated easily and stored somewhere flexible

WooshiiDev commented 4 years ago

I apologize for opening this again, then closing