Use IDynamicTypeFactory instead of new T() in SharedMechanismComponent.cs

This commit is contained in:
Pieter-Jan Briers
2020-11-20 15:45:10 +01:00
parent 848cb8df62
commit 315b0621bc

View File

@@ -158,8 +158,7 @@ namespace Content.Shared.GameObjects.Components.Body.Mechanism
return true;
}
behavior = new T();
IoCManager.InjectDependencies(behavior);
behavior = IoCManager.Resolve<IDynamicTypeFactory>().CreateInstance<T>();
_behaviors.Add(typeof(T), behavior);
behavior.Initialize(this);
behavior.Startup();