Troubleshooting
Docs / Adapter (Unity) / Troubleshooting
Common issues and solutions for ZenECS Unity Adapter.
Common Issues
EcsDriver Not Found
Symptoms:
KernelLocator.Currentthrows exception- No kernel available
Solutions:
- Add
EcsDrivercomponent to scene - Or create kernel manually:
var kernel = new Kernel(); ZenEcsUnityBridge.Kernel = kernel;
EntityLink Not Working
Symptoms:
- GameObject not linked to entity
EntityViewRegistry.TryGetLink()returns null
Solutions:
- Verify
EntityLinkis attached:var link = gameObject.GetComponent<EntityLink>(); if (link == null) link = gameObject.AddComponent<EntityLink>(); - Check link is attached:
if (!link.IsAlive) link.Attach(world, entity);
Blueprint Spawn Fails
Symptoms:
- Entity not created
- Components not applied
Solutions:
- Verify world is active:
var world = KernelLocator.CurrentWorld; if (world == null) world = kernel.CreateWorld(null, "GameWorld", setAsCurrent: true); - Check shared context resolver:
var resolver = ZenEcsUnityBridge.SharedContextResolver; if (resolver == null) resolver = new SharedContextResolver();
Systems Not Running
Symptoms:
- System code not executing
- No entities processed
Solutions:
- Verify system is registered:
world.AddSystems([new MySystem()]); - Check system has correct attribute:
[FixedGroup] // or [FrameGroup] public class MySystem : ISystem { } - Ensure world is being stepped:
// EcsDriver handles this automatically // Or manually: kernel.PumpAndLateFrame(...)
Components Not Updating
Symptoms:
- Component values not changing
- Changes not reflected
Solutions:
- Use command buffer for writes:
using var cmd = world.BeginWrite(); cmd.ReplaceComponent(entity, newComponent); - Check system is running
- Verify entity is alive:
if (world.IsAlive(entity)) { // Entity is valid }
Performance Issues
Slow Queries
Symptoms:
- Queries are slow
- Frame rate drops
Solutions:
- Filter early in pipeline
- Cache query results when possible
- Use appropriate data structures
- Profile to find bottlenecks
Memory Leaks
Symptoms:
- Memory usage grows
- Entities not cleaned up
Solutions:
- Destroy entities properly:
using (var cmd = world.BeginWrite()) { cmd.DestroyEntity(entity); } - Unregister binders:
world.UnregisterBinder(entity, binder); - Dispose worlds:
kernel.Dispose();
Integration Issues
Zenject Not Working
Symptoms:
- Systems not resolved
- Contexts not resolved
Solutions:
- Verify Zenject is installed
- Check
ZENECS_ZENJECTdefine is set - Configure
ProjectInstaller:Container.Bind<ISystemPresetResolver>() .To<SystemPresetResolver>() .AsSingle();
UniRx Not Working
Symptoms:
- Observable methods not available
- Compilation errors
Solutions:
- Verify UniRx is installed
- Check
ZENECS_UNIRXdefine is set - Use conditional compilation:
#if ZENECS_UNIRX world.ObserveMessages<Message>(); #endif
Debugging Tips
Enable Logging
// Enable debug logging
ZenEcsUnityBridge.EnableLogging = true;
Use ECS Explorer
Open Window → ZenECS → Tools → ZenECS Explorer to inspect:
- Systems and execution
- Entities and components
- Messages and binders
Check Entity State
// Verify entity is alive
if (world.IsAlive(entity))
{
// Check components
if (world.HasComponent<Position>(entity))
{
var pos = world.Get<Position>(entity);
Debug.Log($"Position: {pos.X}, {pos.Y}");
}
}
Getting Help
If you can't resolve an issue:
- Check Documentation: Review relevant guides
- Search Issues: Look for similar problems
- Create Issue: Provide detailed information
- Ask Community: Use GitHub Discussions
See Also
- FAQ - Common questions
- Support - Get help
- ECS Explorer - Debugging tool