public void PopDamage(Vector3 position, int damage) { GameObject damagePop = Instantiate(damagePrefab, position, Quaternion.identity); DamagePop dmp = damagePop.GetComponent <DamagePop>(); dmp.Setup(damage); }
//Create DamagePopUp Text public static DamagePop Create(Vector3 position, float damageAmount) { //Instantiate the damage text prefab Transform damagePopTransform = Instantiate(GameAssets.instance.damagePop, position, Quaternion.identity); //Get the gameobject position DamagePop damagePop = damagePopTransform.GetComponent <DamagePop>(); //Return damage value into the text damagePop.Setup(damageAmount); return(damagePop); }