private void CreateUnit(Vector3 pos /*, string debugInfo*/) { GameObject newObj = Instantiate(SampleUnit.gameObject, pos, SampleUnit.transform.rotation, LevelsMgr.CurrentLevel.transform); newObj.gameObject.name += "_" + ++UnitMgr.NamingCount; newObj.gameObject.SetActive(true); newObj.gameObject.AddComponent <LevelChildDeleteOnReset>(); Unit u = newObj.GetComponent <Unit>(); u.Name = UnitMgr.NamingCount.ToString(); //Debug.Log("Spawner.CreateUnit(" + u.name + ") | " + newObj.GetComponentInChildren<UnitWeapon>()); //u.TestDebugOutput = debugInfo; UnitMgr.Units.Add(u); u.Birth(Team); if (Team == Teams.Baddies) { //keep track of baddies spawned count to determine when the next wave should come UnitMgr.BaddiesSpawnedSinceLastWave++; } newObj.GetComponentInChildren <ObjectColor>() ?.SetOriginalColor(Team == Teams.Baddies ? new Color(1f, 0.5f, 0) /*orange*/: Color.white); }