public void SpawnCombatText(Vector3 location, int damage, Color myColor, bool isCrit) { GameObject hitText = Instantiate(combatText, new Vector3(location.x, location.y, location.z + 1), new Quaternion(0, 0, 0, 0)) as GameObject; CombatText script = hitText.GetComponent <CombatText>(); script.init(damage, myColor, isCrit); }