Closed KonH closed 3 years ago
I've been doing a little debugging and I'm THINKING the whole conversion to "assetRelativePath" is unnecessary because these should already be Assets-relative (if they're in the Assets folder). I'm guessing I originally did System.IO to find files in a directory, discovered that misses sub-assets (like sprites), and then made it use AssetDatabase and didn't realize I could then remove this line.
Basically I think a better fix would be to just delete the original line
var assetRelativePath = filePath.Substring(filePath.IndexOf("Assets/"));
and convert the loop to use the filePath directly. I think this should be identical in behavior.
Would you mind doing that instead here? I'll test it in various scenarios on my end.
Looks like it's better solution, you're right. I made proposed changes and it works (at least on trivial use cases).
Ok thanks! Rebased to Staging and merged!
It is possible to select assets outside Assets directory (like Packages), it leads to exception spam (see #281) so we need to detect top parent directory dynamically