EllanJiang/GameFramework · error · GameFrameworkException
Results is invalid.
Error message
Results is invalid.
What it means
GetChildEntities copies all child entities of an entity into the caller-supplied results list. It throws GameFrameworkException when the results list is null, since there is nowhere to write the output. The entity itself does not need children — an empty list is valid — only a null list is rejected.
Solutions
- Allocate a List<IEntity> and pass it to GetChildEntities.
- Null-check the list at the call site.
- Prefer the overload that returns entity ids if you do not need the list reuse.
Example fix
// before entityInfo.GetChildEntities(null); // after List<IEntity> children = new List<IEntity>(); entityInfo.GetChildEntities(children);
Defensive patterns
Strategy: validation
Validate before calling
if (results == null) results = new List<IEntity>(); entityInfo.GetChildEntities(results);
Type guard
bool IsValidResults(List<IEntity> results) => results != null;
Try / catch
try { entityInfo.GetChildEntities(results); }
catch (GameFrameworkException ex) { Log.Error("GetChildEntities failed: {0}", ex.Message); } Prevention
- Allocate the results list before calling fill-list APIs
- Don't pass nullable list returns straight through
- Reuse a scratch list per query to avoid nulls
When it happens
Trigger: Calling EntityInfo.GetChildEntities(null) or the EntityManager.GetChildEntities overload with a null List<IEntity>.
Common situations: Forgetting to allocate the results list before querying; refactoring from an allocation-returning API to the fill-list API and keeping the argument null.
Related errors
- Entity 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/10f2f7d8eb6ab912.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Entity/EntityManager.EntityInfo.cs:107
m_ParentEntity = null;
m_ChildEntities.Clear();
}
public IEntity GetChildEntity()
{
return m_ChildEntities.Count > 0 ? m_ChildEntities[0] : null;
}
public IEntity[] GetChildEntities()
{
return m_ChildEntities.ToArray();
}
public void GetChildEntities(List<IEntity> results)
{
if (results == null)
{
throw new GameFrameworkException("Results is invalid.");
}
results.Clear();
foreach (IEntity childEntity in m_ChildEntities)
{
results.Add(childEntity);
}
}
public void AddChildEntity(IEntity childEntity)
{
if (m_ChildEntities.Contains(childEntity))
{
throw new GameFrameworkException("Can not add child entity which is already exist.");
}
m_ChildEntities.Add(childEntity);
}View on GitHub (pinned to d0c010b051)