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; return true;
} }
behavior = new T(); behavior = IoCManager.Resolve<IDynamicTypeFactory>().CreateInstance<T>();
IoCManager.InjectDependencies(behavior);
_behaviors.Add(typeof(T), behavior); _behaviors.Add(typeof(T), behavior);
behavior.Initialize(this); behavior.Initialize(this);
behavior.Startup(); behavior.Startup();