VContainer
VContainer copied to clipboard
Can't add unmanaged systems via NewWorldBuilder
I want to use World Builder as a declarative list of all systems. Adding managed systems causes no problems whether it has injection or not. Unmanaged systems, however, are so far impossible to register via the builder:
-
AddUnmanagedrequires an instance of the system to be passed - Adding the system manually via
builder.RegisterUnmanagedSystemIntoWorldyields to having an exception ofVContainerException: Type does not found injectable constructor- Adding an
[Inject]-marked method does not solve an issue, even if it has some registered dependency as an unused argument - Also, it is impossible to add a constructor to a unmanaged system, since it requires to initialize the technical fields
- Adding an
So, it would be great to have an opportunity to register unmanaged systems into a new world without having to pass an instance and without needing to inject anything into them, smth like:
builder.UseNewWorld("World", Lifetime.Scoped, worldBuilder =>
{
worldBuilder.AddUnmanaged<MyUnmanagedSystem>();
}
HI, You can refer to the following Test file. https://github.com/hadashiA/VContainer/blob/master/VContainer/Assets/Tests/Unity/EcsTest.cs