EllanJiang/GameFramework · error · GameFrameworkException
Object pool manager is invalid.
Error message
Object pool manager is invalid.
What it means
EntityManager.SetObjectPoolManager rejects a null IObjectPoolManager argument. The entity system stores unspawned entities in object pools, so it cannot operate without an object pool manager; passing null means the manager would be left in a non-functional state, and the framework throws a GameFrameworkException instead of silently accepting it.
Solutions
- Ensure the ObjectPoolComponent (IObjectPoolManager) is created and initialized before calling SetObjectPoolManager.
- Check that the code retrieving the object pool manager returns a valid instance, not null.
- Fix initialization order in your bootstrap/GameEntry so EntityComponent depends on ObjectPoolComponent.
Example fix
// before
m_EntityManager.SetObjectPoolManager(null); // throws
// after
IObjectPoolManager objectPoolManager = GameEntry.GetComponent<ObjectPoolComponent>();
if (objectPoolManager != null)
{
m_EntityManager.SetObjectPoolManager(objectPoolManager);
} Defensive patterns
Strategy: validation
Validate before calling
IObjectPoolManager poolManager = GameEntry.GetComponent<ObjectPoolComponent>();
if (poolManager == null) throw new InvalidOperationException("ObjectPoolComponent must be initialized before entity manager"); Type guard
bool HasObjectPoolManager(EntityManager em) => em != null && em.ObjectPoolManager != null;
Try / catch
try
{
entityManager.SetObjectPoolManager(poolManager);
}
catch (GameFrameworkException ex)
{
Debug.LogError($"Entity init failed: {ex.Message}");
} Prevention
- Initialize ObjectPoolComponent before EntityComponent in GameEntry.
- Assert non-null dependencies at startup rather than passing them blindly.
- Use a single bootstrap sequence for all framework manager wiring.
When it happens
Trigger: Calling EntityManager.SetObjectPoolManager(null), typically during framework initialization when the ObjectPool component was not yet created or was retrieved with a lookup that returned null.
Common situations: Initialization order mistakes: calling SetObjectPoolManager before adding/initializing the ObjectPoolComponent, typos in component retrieval, or custom bootstrap code that skips dependency injection of the object pool manager.
Related errors
- Resource manager is invalid.
- Resource manager is invalid.
- Data provider helper is invalid.
- Entity is invalid.
- Results is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/b4a39aaf14bb56b4.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Entity/EntityManager.cs:208
internal override void Shutdown()
{
m_IsShutdown = true;
HideAllLoadedEntities();
m_EntityGroups.Clear();
m_EntitiesBeingLoaded.Clear();
m_EntitiesToReleaseOnLoad.Clear();
m_RecycleQueue.Clear();
}
/// <summary>
/// 设置对象池管理器。
/// </summary>
/// <param name="objectPoolManager">对象池管理器。</param>
public void SetObjectPoolManager(IObjectPoolManager objectPoolManager)
{
if (objectPoolManager == null)
{
throw new GameFrameworkException("Object pool manager is invalid.");
}
m_ObjectPoolManager = objectPoolManager;
}
/// <summary>
/// 设置资源管理器。
/// </summary>
/// <param name="resourceManager">资源管理器。</param>
public void SetResourceManager(IResourceManager resourceManager)
{
if (resourceManager == null)
{
throw new GameFrameworkException("Resource manager is invalid.");
}
m_ResourceManager = resourceManager;
}View on GitHub (pinned to d0c010b051)