Unity-Technologies/UnityCsReference · critical · NullReferenceException
Failure to load editor resource asset bundle.
Error message
Failure to load editor resource asset bundle.
What it means
Thrown by EditorGUIUtility.Load when EditorResources.Load returns null and the editor asset bundle (GetEditorAssetBundle) is also null. The guard explicitly skips throwing in batch mode (returns null), but in the interactive editor a missing bundle is fatal because UI styles/icons cannot be resolved. The exception type is NullReferenceException to halt the editor startup.
Source
Thrown at Editor/Mono/EditorGUIUtility.cs:1365
public static UnityObject Load(string path)
{
return Load(path, typeof(UnityObject));
}
[TypeInferenceRule(TypeInferenceRules.TypeReferencedBySecondArgument)]
private static UnityObject Load(string filename, Type type)
{
var asset = EditorResources.Load(filename, type);
if (asset != null)
return asset;
AssetBundle bundle = GetEditorAssetBundle();
if (bundle == null)
{
// If in batch mode, loading any Editor UI items shouldn't be needed
if (Application.isBatchMode)
return null;
throw new NullReferenceException("Failure to load editor resource asset bundle.");
}
asset = bundle.LoadAsset(filename, type);
if (asset != null)
{
asset.hideFlags |= HideFlags.HideAndDontSave;
return asset;
}
return AssetDatabase.LoadAssetAtPath(filename, type);
}
public static void PingObject(UnityObject obj)
{
if (obj != null)
PingObject(obj.GetEntityId());
}
View on GitHub (pinned to 225b0fbdb5)
Solutions
- Reinstall or repair the Unity editor to restore the editor asset bundle.
- If running in automation/CI, prefer batch mode (-batchmode) so the missing UI bundle is tolerated.
- Verify the editor install directory is complete and not partially synced.
- Disable antivirus interference or add the Unity install folder to exclusions and reinstall.
Example fix
// no code fix; this is an environment/install integrity issue. // before: launching editor interactively with missing bundle -> throws. // after: reinstall editor OR launch with -batchmode for headless workflows.
Defensive patterns
Strategy: fallback
Validate before calling
if (Application.isBatchMode) { /* skip UI resource load */ } Try / catch
try { return EditorGUIUtility.Load(path, type); } catch (NullReferenceException) { return null; /* tolerate in custom tooling, report install corruption */ } Prevention
- Run headless workflows with -batchmode so missing UI bundles are tolerated.
- Verify the Unity install integrity (resource bundle present) before launching.
- Exclude the Unity install folder from antivirus quarantine.
When it happens
Trigger: Editor UI bootstrap path resolving a resource (style, icon, font) before the editor asset bundle is initialized. Triggered when the bundle file is missing, corrupt, or fails to load, and the editor is not in batch mode.
Common situations: Corrupted Unity install (the editor resource bundle was deleted or never extracted); a custom editor build missing skin resources; antivirus quarantining the bundle; running an editor from a partial extraction of the install archive.
Related errors
- Could not find editor resource ${assetPath}
- No valid types in required type list
- Parameter selected must be of type System.Enum
- Parameter enumValue must be of type System.Enum
- Unsupported enum base type for {0}
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/0fbed4197822a266.
Report an issue: GitHub.