WooshiiDev/HierarchyDecorator

Settings object fails to create with FMOD installed

JClarkRichardson opened this issue · 2 comments

Hello! Thought I'd let you know about an odd conflict of settings I discovered. My project has the FMOD Unity plugin installed, and when I tried installing Hierarchy Decorator, it gave me a null reference exception at line 101 of HierarchyDecorator.cs. After digging into it a bit, it seems the settings asset was failing to be created/found. Trying to trace where the problem was, I discovered that it seemed to think the settings asset already existed, which it didn't, and was then failing to create a new one.

In AssetUtility.cs, in FindOrCreateScriptable, the guids array is getting populated with one pre-existing asset: FMODStudioSettings.asset.

I discovered this by adding after line 56:

string scriptablePathTest = AssetDatabase.GUIDToAssetPath(guids[0]);
Debug.Log(scriptablePathTest);

This printed:

Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset
UnityEngine.Debug:Log (object)

So I'm not sure why, but when the utility tries to find or create the settings, instead of creating the settings, it finds the FMOD settings, thinks its what it's looking for, and then throws an error because it's not actually the settings it needs. I'm not sure how to fix this exactly, and it's probably a weird edge case, but I thought I should give you a heads up!

EDIT: I forgot to specify, I'm using Unity 2021.1.17f1.

Hey there,

cheers for bringing this to my attention! I'm sure quite some time back I had concerns about conflicts like this as it's looking for assets in the project of a type "Settings".

There are no checks to compare it to HierarchyDec's setting type and only picks out the first asset found. That is an extremely naive and lazy way of implementing this and I apologize for this being caused.

I've assigned high priority to this and I'll get a fix out as soon as possible 🙂

Cheers,
Wooshii

EDIT: On further inspection, FMOD also names their settings type to "Settings". It completely makes sense as to why this happens currently.

Hey there I'm closing this issue as #42 is for the same problem but with a little more information.

Not to worry though, I've made a fix for this in v0.8.5 but will be keeping the other issue open just to make sure everything works before the next released. I don't think keeping two issues that are the same makes sense, and feel its best to keep it as one.

If there's any future issues, always feel free to post another issue or comment.

Cheers,
Wooshii