Experiencing a strange crash with globalgamemanagers

We have built our project into a windows executable. It is very similar to a previous build, some gitignore, meta and DLL files got shifted around/modified. The new build fails, the previous build works. When we do a diff, we see that globalgamemanagers has changed. Replacing the new globalgamemanagers for the old globalgamemanagers actually causes the application to load (and appears to work well).

Any idea what could be triggering that and ways to work around it?

Ok. We’ve identified that the problem stems from us using .gitignore and deleting our old meta files. We need our DLLs to load on startup by default.

Our workflow is a little unique, in that we don’t commit the binaries to our plugins folder. We run a script that does that for us. We have some application logic written in native code that can change and its a big headache when we have conflicts between these files, so we just let the individual engineers run the code to generate the files when they need.

The issue is deleting those files means the .meta files, which dictate whether or not those files should load by default or not, also get deleted, because Unity cleans them up. Those meta files have a setting tweaked, we want to load our plugins at startup by default. Is there a way to configure that?

I see in Unity - Manual: Import and configure plug-ins it calls out that we can implement UnityPluginLoad to possibly configure it to load automagically, but we should assume any of the plugins loaded by Unity are multi-purpose, and we can’t implement those sorts of things at the DLL level.

Should anyone run into anything similar in the future, this code was where I ended up, and it needs to live in the Editor subfolder, it doesn’t get attached to any game objects/live in the unity hierarchy.

public class PluginImportPostprocessor : AssetPostprocessor
    {
        // This method is called whenever assets are imported, deleted, or moved.
        private static void OnPostprocessAllAssets( string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths )
        {
            foreach ( string str in importedAssets )
            {
                if ( str.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) || str.EndsWith(".so", StringComparison.OrdinalIgnoreCase) )
                {
                    PluginImporter pluginImporter = AssetImporter.GetAtPath(str) as PluginImporter;

                    if ( pluginImporter != null  && pluginImporter.isNativePlugin )
                    {
                        pluginImporter.isPreloaded = true;
                        pluginImporter.SaveAndReimport();
                    }
                }
            }
        }
    }