EllanJiang/GameFramework · error · GameFrameworkException
Entity is invalid.
Error message
Entity is invalid.
What it means
EntityInfo.Create is the ReferencePool-backed factory for the internal EntityInfo wrapper of an IEntity. It throws GameFrameworkException when the entity argument is null because an EntityInfo without an entity is meaningless and would corrupt entity management state. This is an internal API but reachable through custom entity code paths.
Solutions
- Ensure the IEntity passed to Create is a valid, non-null instance.
- Check your EntityHelper's instance creation returns non-null (asset loaded correctly).
- Null-check the entity before calling Create.
Example fix
// before
EntityInfo info = EntityInfo.Create(entity); // entity may be null
// after
if (entity != null)
{
EntityInfo info = EntityInfo.Create(entity);
} Defensive patterns
Strategy: validation
Validate before calling
if (entity == null) throw new ArgumentException("entity required");
var info = EntityInfo.Create(entity); Type guard
bool IsValidEntity(IEntity entity) => entity != null;
Try / catch
try { var info = EntityInfo.Create(entity); }
catch (GameFrameworkException ex) { Log.Error("EntityInfo.Create failed: {0}", ex.Message); } Prevention
- Ensure EntityHelper instance creation never returns null
- Validate entity before internal API calls
- Check asset load success before creating entity logic
When it happens
Trigger: Calling EntityInfo.Create(null) directly, or via EntityManager's show/attach flow when the IEntity created by an EntityHelper or entity logic was null.
Common situations: A custom EntityHelper.CreateInstance returning null (missing prefab/asset); entity logic object creation failing silently; misuse of internal APIs in derived entity managers.
Related errors
- Results is invalid.
- Owner is invalid.
- Resource manager is invalid.
- Data provider helper is invalid.
- Type is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/16d2c72e1231f0de.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Entity/EntityManager.EntityInfo.cs:76
set
{
m_ParentEntity = value;
}
}
public int ChildEntityCount
{
get
{
return m_ChildEntities.Count;
}
}
public static EntityInfo Create(IEntity entity)
{
if (entity == null)
{
throw new GameFrameworkException("Entity is invalid.");
}
EntityInfo entityInfo = ReferencePool.Acquire<EntityInfo>();
entityInfo.m_Entity = entity;
entityInfo.m_Status = EntityStatus.WillInit;
return entityInfo;
}
public void Clear()
{
m_Entity = null;
m_Status = EntityStatus.Unknown;
m_ParentEntity = null;
m_ChildEntities.Clear();
}
public IEntity GetChildEntity()
{View on GitHub (pinned to d0c010b051)