You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to be able to create instances of classes that implement ITickable and so they Tick method will be properly called after that.
Right now any way of creating instances and/or binding them using Container do not trigger execution of their Tick method.
I have tried next classes and methods of creating instances. None of them trigger Tick or Initialize.
public class TestZenTick : MonoBehaviour
{
private DiContainer _container;
private TestTickable.Factory _factory;
[Inject]
private void Construct(DiContainer container, TestTickable.Factory factory)
{
_container = container;
_factory = factory;
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
if (_factory == null || _container == null) return;
var t = new TestTickable();
_container.BindInterfacesAndSelfTo<TestTickable>().FromInstance(t).AsSingle().NonLazy();
_factory.Create();
_container.Instantiate<TestTickable>();
_container.BindInterfacesAndSelfTo<TestTickable>().FromFactory<TestTickable,TestTickable.Factory>().NonLazy();
_container.BindInterfacesAndSelfTo<TestTickable>().FromNew().NonLazy();
}
public class TestTickable : ITickable, IInitializable
{
public void Tick()
{
Debug.Log("Tick");
}
public class Factory : PlaceholderFactory<TestTickable> { }
public void Initialize()
{
Debug.Log("Initialize");
}
}
}
The text was updated successfully, but these errors were encountered:
I need to be able to create instances of classes that implement ITickable and so they Tick method will be properly called after that.
Right now any way of creating instances and/or binding them using Container do not trigger execution of their Tick method.
I have tried next classes and methods of creating instances. None of them trigger Tick or Initialize.
The text was updated successfully, but these errors were encountered: