Assets/Live2D/Cubism/Plugins/Editor/CubismWebGLPluginProcessor.cs
/// <summary>
/// Enable the appropriate plugins from your Unity version before building.
/// </summary>
Enable the appropriate plugins from your Unity version before building.
Enable the appropriate plugins from your Unity version before building .
public void OnPreprocessBuild(BuildReport report)
    {
        if (report.summary.platform != BuildTarget.WebGL)
        {
            return;
        }
        var targetPlugin =
#if UNITY_2021_2_OR_NEWER
            CubismWebGLPlugin.Latest;
#else
            CubismWebGLPlugin.Previous;
#endif
        var pluginImporters = PluginImporter.GetAllImporters()
            .Where(pluginImporter =>
                Regex.IsMatch(
                    pluginImporter.assetPath,
                    @"^.*/Experimental/Emscripten/.*/Live2DCubismCore.bc$"
                )
            )
            .ToArray();
        foreach (var pluginImporter in pluginImporters)
        {
            pluginImporter.SetCompatibleWithPlatform(
                BuildTarget.WebGL,
                pluginImporter.assetPath.Contains(targetPlugin.DirectoryName)
            );
        }
    }
public void OnPreprocessBuild ( BuildReport report ) { if ( report . summary . platform != BuildTarget . WebGL ) { return ; } var targetPlugin = if UNITY_2021_2_OR_NEWER CubismWebGLPlugin . Latest ; else CubismWebGLPlugin . Previous ; endif var pluginImporters = PluginImporter . GetAllImporters ( ) . Where ( pluginImporter => Regex . IsMatch ( pluginImporter . assetPath , @"^.*/Experimental/Emscripten/.*/Live2DCubismCore.bc$" ) ) . ToArray ( ) ; foreach ( var pluginImporter in pluginImporters ) { pluginImporter . SetCompatibleWithPlatform ( BuildTarget . WebGL , pluginImporter . assetPath . Contains ( targetPlugin . DirectoryName ) ) ; } }
Enable the appropriate plugins from your Unity version before building.
Enable the appropriate plugins from your Unity version before building .
// Skip the process if the build is not for WebGL. // Detect the type of WebGL plugin by SDK type and SDK version in the build settings. // Extract the Cubism WebGL plugin from the plugin. // Enable only the appropriate plugins.
report
BuildReport