We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Injected Tickable Instance don't run Tick method, when class is registerd as Lifetime.Transient,
Maybe because create new instance when EntryPointDispatcher runs, and register it as TickableLoopItem.
Then, only new instance's Tick medhod called in TickableLoopItem's MoveNext. Other instance injected the classes is not called.
Following is simple testcode. I expected display log "edited from Sample class". But acturally displayed "empty".
public class SampleContainerBuilder : LifetimeScope { protected override void Configure(IContainerBuilder builder) { builder.RegisterEntryPoint<SampleTick>(Lifetime.Transient) .AsImplementedInterfaces() .AsSelf(); builder.Register<Sample>(Lifetime.Singleton) .AsImplementedInterfaces() .AsSelf(); } } public class Sample : IStartable { private SampleTick _sampleTick; [Inject] public Sample(SampleTick sampleTick) { _sampleTick = sampleTick; } public void Start() { _sampleTick.logText = "edited from Sample class"; } } public class SampleTick : ITickable { public string logText = "empty"; public void Tick() { Debug.Log(logText); } }
== my environment== Unity 2022.3.10f1 VContainer 1.13.2 and 1.14.0 (This occured both version) using SourceGeneratorDLL
The text was updated successfully, but these errors were encountered:
Your class Sample must be registered by RegisterEntryPoint, cause it have IStartable interface
Sorry, something went wrong.
Oh, sorry for my miss registration. But I confirmed by debugger start medhod was called in that code.
And now I tried again with following containerbuilder. But the same thing happened...
public class SampleContainerBuilder : LifetimeScope { protected override void Configure(IContainerBuilder builder) { builder.RegisterEntryPoint<SampleTick>(Lifetime.Transient) .AsImplementedInterfaces() .AsSelf(); builder.RegisterEntryPoint<Sample>(); } }
No branches or pull requests
Injected Tickable Instance don't run Tick method, when class is registerd as Lifetime.Transient,
Maybe because create new instance when EntryPointDispatcher runs, and register it as TickableLoopItem.
Then, only new instance's Tick medhod called in TickableLoopItem's MoveNext.
Other instance injected the classes is not called.
Following is simple testcode.
I expected display log "edited from Sample class".
But acturally displayed "empty".
== my environment==
Unity 2022.3.10f1
VContainer 1.13.2 and 1.14.0 (This occured both version)
using SourceGeneratorDLL
The text was updated successfully, but these errors were encountered: