stride3d/stride · error · ArgumentException
The given type is not an EntityComponent type
Error message
The given type is not an EntityComponent type
What it means
GetGizmoType walks the component type hierarchy looking up StrideDefaultAssetsPlugin.GizmoTypeDictionary; if the walk reaches a null BaseType without ever finding a gizmo type, the type is not recognized as an EntityComponent-derived type and an ArgumentException is thrown.
Solutions
- Pass a Type that derives (directly or indirectly) from Stride.Engine.EntityComponent
- Register a gizmo type for the component type in GizmoTypeDictionary (via the StrideDefaultAssetsPlugin registration)
- If the component has no gizmo, ensure its base chain reaches EntityComponent so null is returned instead of an exception
- Check that the correct stride assets plugin assemblies are loaded so the dictionary is populated
Example fix
// before
var gizmoType = service.GetGizmoType(typeof(MyCustomThing)); // not an EntityComponent
// after
var gizmoType = typeof(EntityComponent).IsAssignableFrom(typeof(MyCustomThing))
? service.GetGizmoType(typeof(MyCustomThing)) : null; Defensive patterns
Strategy: validation
Validate before calling
if (componentType == null || !typeof(EntityComponent).IsAssignableFrom(componentType))
throw new ArgumentException("Type must derive from EntityComponent", nameof(componentType)); Type guard
static bool IsEntityComponent(Type t) => t != null && typeof(EntityComponent).IsAssignableFrom(t);
Try / catch
try { gizmoType = GetGizmoType(componentType); }
catch (ArgumentException) { gizmoType = null; /* no gizmo for this type */ } Prevention
- Only pass EntityComponent-derived types to gizmo resolution
- Register gizmo types for all custom components
- Prefer treating null return (EntityComponent base hit) as 'no gizmo' rather than an error
When it happens
Trigger: Calling GetGizmoType (via gizmoType/attribute helpers in EditorGameComponentGizmoService) with a componentType that is neither registered in the gizmo dictionary nor derives from a registered type, and whose hierarchy bottoms out before hitting EntityComponent.
Common situations: Passing a plain class (not an EntityComponent subclass) to the gizmo resolution; building against a stride version where a component's base registration was removed; typos leading to the wrong Type being resolved.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Value type for root objects are not supported
- The index must be an int.
- The index must be an int.
- IEntityGizmo ' ' must have a constructor with exactly one…
- The action must be FolderRenamed when using this…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/694180f4432b95a2.
Report an issue: GitHub.
Appendix: source
Thrown at sources/editor/Stride.Assets.Presentation/AssetEditors/EntityHierarchyEditor/Game/EditorGameComponentGizmoService.cs:359
gizmo.IsEnabled = isVisible;
}
private void RemoveGizmo(IDictionary<EntityComponent, IEntityGizmo> gizmoEntities, IEntityGizmo gizmo, EntityComponent component)
{
sceneGizmos.Remove(gizmo);
gizmoEntities.Remove(component);
gizmo.Dispose();
}
private Type GetGizmoType(Type componentType)
{
if (componentType == null) throw new ArgumentNullException(nameof(componentType));
Type gizmoType;
while (!StrideDefaultAssetsPlugin.GizmoTypeDictionary.TryGetValue(componentType, out gizmoType))
{
componentType = componentType.BaseType;
if (componentType == null) throw new ArgumentException(@"The given type is not an EntityComponent type", nameof(componentType));
if (componentType == typeof(EntityComponent))
return null;
}
return gizmoType;
}
void IEditorGameComponentGizmoViewModelService.ToggleGizmoVisibility(Type componentType, bool isVisible)
{
controller.InvokeAsync(() =>
{
var gizmoType = componentType != typeof(TransformComponent) ? GetGizmoType(componentType) : typeof(FallbackGizmo);
if (gizmoType == null)
return;
gizmoVisibilities[gizmoType] = isVisible;
foreach (var gizmo in sceneGizmos)
{
if (gizmo.GetType() == gizmoType)View on GitHub (pinned to 96fad776d2)