8000 Add quick fix for duplicate migration folder creation by shiyouganai · Pull Request #25 · PiMaker/ltcgi · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add quick fix for duplicate migration folder creation #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

shiyouganai
Copy link
Contributor

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:

  1. Create empty Unity project
  2. Install LTCGI package from git url
  3. Add LTCGI Controller to scene
  4. Delete LTCGI package and its Assets/ folders but leave scene as-is, then reinstall package

The function MigratoryBirdsDontMigrateAsMuchAsWeDoButThisFunctionWillTakeCareOfItNonetheless (lol) is running multiple times and at least one subsequent invocation of the function beyond the first doesn't have its AssetDatabase.IsValidFolder calls return true, 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!

This commit adds a quick fix for an issue where duplicate asset
folders were created if a user migrated to the package version
of LTCGI when there was already an LTCGI Controller in their
open scene.
@PiMaker
Copy link
Owner
PiMaker commented Nov 10, 2023

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...

@PiMaker
Copy link
Owner
PiMaker commented Apr 27, 2024

This should be fixed in #26.

@PiMaker PiMaker closed this Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0