egametang/ET · critical · BuildFailedException

You have not initialized HybridCLR, please install it via me

Error message

You have not initialized HybridCLR, please install it via menu 'HybridCLR/Installer'

What it means

Thrown by PrebuildCommand.GenerateAll when InstallerController.HasInstalledHybridCLR() returns false. HybridCLR requires a one-time installation that clones and patches the local IL2CPP toolchain; Generate/All depends on that toolchain being present.

Source

Thrown at Packages/cn.etetet.hybridclr/Scripts/Editor/Share/Commands/PrebuildCommand.cs:22

using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEditor.Build;

namespace HybridCLR.Editor.Commands
{
    public static class PrebuildCommand
    {
        /// <summary>
        /// 按照必要的顺序,执行所有生成操作,适合打包前操作
        /// </summary>
        [MenuItem("HybridCLR/Generate/All", priority = 200)]
        public static void GenerateAll()
        {
            var installer = new Installer.InstallerController();
            if (!installer.HasInstalledHybridCLR())
            {
                throw new BuildFailedException($"You have not initialized HybridCLR, please install it via menu 'HybridCLR/Installer'");
            }
            BuildTarget target = EditorUserBuildSettings.activeBuildTarget;
            CompileDllCommand.CompileDll(target, EditorUserBuildSettings.development);
            Il2CppDefGeneratorCommand.GenerateIl2CppDef();

            // 这几个生成依赖HotUpdateDlls
            LinkGeneratorCommand.GenerateLinkXml(target);

            // 生成裁剪后的aot dll
            StripAOTDllCommand.GenerateStripedAOTDlls(target);

            // 桥接函数生成依赖于AOT dll,必须保证已经build过,生成AOT dll
            MethodBridgeGeneratorCommand.GenerateMethodBridgeAndReversePInvokeWrapper(target);
            AOTReferenceGeneratorCommand.GenerateAOTGenericReference(target);
        }
    }
}

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Run HybridCLR/Installer from the Unity menu and wait for it to report success, then re-run Generate/All.
  2. If on CI, add an installation step that runs before any Generate command, or cache the HybridCLRData directory across runs.
  3. After a Unity upgrade, re-run the installer -- old installs are version-specific and will not satisfy HasInstalledHybridCLR for the new version.
Defensive patterns

Strategy: validation

Validate before calling

var installer = new Installer.InstallerController();
if (!installer.HasInstalledHybridCLR())
    Debug.LogError("HybridCLR not installed -- run HybridCLR/Installer before generating code.");

Prevention

When it happens

Trigger: Selecting the menu HybridCLR/Generate/All before ever running HybridCLR/Installer. The installer check probes whether the local HybridCLR data directory and patched libil2cpp exist.

Common situations: Fresh project checkout on a new machine or CI agent where HybridCLR was never installed; the HybridCLRData folder was deleted or never committed (it is typically gitignored); Unity was upgraded to a new minor version invalidating the previous install.

Related errors


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/cb171548d6f3b290. Report an issue: GitHub.