Skip to content
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

Usage from within Unity #3

Open
hybridherbst opened this issue Aug 16, 2022 · 3 comments
Open

Usage from within Unity #3

hybridherbst opened this issue Aug 16, 2022 · 3 comments

Comments

@hybridherbst
Copy link

I tried using these tools from inside Unity to analyze import artifacts and for build postprocessors of generated data, which to be best of my understanding fall under SerializedFile.

However, it seems that the app doesn't properly work with domain load and unload, after a first attempt I'm always getting
20220816-192134-APN1-Unity_FBNg

for subsequent tries.
Are there plans to get this to work?

I found a relevant comment in the UnityFileSystem constructor that leads me to believe this is a bug / not implemented:

static UnityFileSystem()
{
    // Initialize the native library.
    var r = DllWrapper.Init();
    HandleErrors(r);
            
    // TODO: should Cleanup be called by the AppDomain.Unload event or something else?
}
@hybridherbst
Copy link
Author

This seems to do the trick, instead of the static constructor:

[InitializeOnLoadMethod]
static void Init()
{
    var r = DllWrapper.Init();
    HandleErrors(r);
    AssemblyReloadEvents.beforeAssemblyReload += () => DllWrapper.Cleanup();
}

@francis-page
Copy link
Contributor

Thank you for reporting this. To be honest, I did not design the code to work inside Unity. I will see if I can find a way to fix it so it can work inside or outside Unity without any change.

@hybridherbst
Copy link
Author

The above is already enough to get it working in Unity! Could use an ifdef so that the functionality works both in and outside Unity.

Also, it would be interesting to have examples for parsing files with it – I was successfully able to parse many of the asset database artifacts, but I wasn't able to parse scene files, for example (as they seem to live inside memory, not on disk).

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

No branches or pull requests

2 participants