Closed shiyouganai closed 6 months ago
Mh, I think the better fix here would be to change that function to just use System.IO.File
and System.IO.Directory
classes instead of the AssetDatabase
methods, but maybe your solution would work too? I'd worry it might miss some scenarios if it doesn't always check the actual folder though.
The empty duplicate folder thing even plagues UdonSharp, so this isn't a unique issue at least...
This should be fixed in #26.
This is a hack fix for a small, arcane issue that I don't know the exact root cause of, but the symptom was that when I deleted my manually installed version of LTCGI tonight and migrated to the package install via github url, the scripts created a handful of empty, duplicate folders in my
Assets
directory.Steps to recreate bug:
Assets/
folders but leave scene as-is, then reinstall packageThe function
MigratoryBirdsDontMigrateAsMuchAsWeDoButThisFunctionWillTakeCareOfItNonetheless
(lol) is running multiple times and at least one subsequent invocation of the function beyond the first doesn't have itsAssetDatabase.IsValidFolder
calls returntrue
, despite the folders existing.I don't know why. It may have something to do with the nature of the asset database: the result of the folder creation may not be available via the API until some later point, depending on when the API is used? (This is beyond my level of Unity expertise. I was led to that hypothesis after reading the "Asset Import Order" part of this doc.)
So I made sure those folders are only checked once per whatever interval Unity resets static variables. I also removed the manual database refresh because I think if you're just using the
AssetDatabase
API you don't need to manually refresh.If you know an actual not hack fix or just want to close this as a won't-fix, it's no big deal, but I figured I'd open it anyway!