MLProject validation takes more than 3 seconds on recompile


Compared to OpenXR which takes 12 ms.
Something is up here. Can we get the option to disable validation?

Hi @TheMunk,

I will reach out to one of our developers to see what's going on with the project validation process and check for expected behavior. Thanks for bringing this to our attention.

Best,

El

1 Like

Hi @TheMunk,

Thank you for bringing this to our attention. I've passed this information on. However, it is not possible to disable the validation process at this time.

Thanks,

El

1 Like

We just forked the unity package and commented out the code.

Hi Etucker!

Just adding this here as another bug report since it's from the same UPM package;

OnPreprocessTexture in the MagicLeapTexturePostprocessor.cs does not check if the texture import settings have been overridden. This is again our fix;

void OnPreprocessTexture()
        {
            // Only preprocess textures if the MagicLeap loader is active for Android
            if (!BuildHelperUtils.HasLoader(BuildTargetGroup.Android, typeof(MagicLeapLoader)))
                return;
            
            TextureImporter textureImporter  = assetImporter as TextureImporter;
            if (textureImporter)
            {
                TextureImporterPlatformSettings settings = textureImporter.GetPlatformTextureSettings("Android");
                
                if (settings.overridden)
                    return;
                
                TextureImporterFormat oldFormat = settings.format;
                TextureImporterFormat newFormat = GetCompatibleTextureCompression(oldFormat);
                if (oldFormat != newFormat)
                {
                    settings.format = newFormat;
                    string logMessage = "Magic Leap 2 Texture import - " + assetPath +
                                        " - Changing Android texture compression from " +
                                        oldFormat + " to " + newFormat;
                    context.LogImportWarning(logMessage);
                    textureImporter.SetPlatformTextureSettings(settings);
                }
            }
        }

Hi @TheMunk,
Thank you for reporting this! I'll notify the engineering team at Unity.

1 Like

What code did you comment out to get faster recompile times?

Just simply the [InitializeOnLoadMethod] attribute over static void MagicLeapProjectValidationCheck().
It's not a "fix" but we believe we have set up the project correctly. We could just add a menu to this method instead and then call the check once in a while or through our build pipeline.

Thank you! I'm creating a bug report now and will update the thread as I get more information.