protected virtual void OnEnable() { EmissionsManager.AddEmissions(Settings.Emissions); string renderer = UnitRenderer.GetRenderer(Settings.Symbol); if (renderer != "") { unitRenderer = ObjectPool.Instantiate(renderer) as UnitRenderer; unitRenderer.transform.SetParent(MyTransform); unitRenderer.transform.localPosition = unitRenderer.Offset; } }
protected virtual void OnDisable() { EmissionsManager.RemoveEmissions(Settings.Emissions); if (Selected) { SelectionManager.Unselect(); } string renderer = UnitRenderer.GetRenderer(Settings.Symbol); if (renderer != "") { if (unitRenderer != null) { ObjectPool.Destroy(unitRenderer); unitRenderer = null; } } }