public void Add <T>(MyComponentBase component) where T : MyComponentBase { #if DEBUG using (Stats.Generic.Measure("ComponentContainer.Add", VRage.Stats.MyStatTypeEnum.Counter, 1000, numDecimals: 3)) using (Stats.Generic.Measure("ComponentContainer.AddMs", VRage.Stats.MyStatTypeEnum.Max, 1000, numDecimals: 3)) #endif { Type t = typeof(T); Remove <T>(); if (component != null) { m_components[t] = component; component.OnAddedToContainer(this); var handle = ComponentAdded; if (handle != null) { handle(t, component); } } } }