Hi! I’m trying to do something that I don’t really know how to do it, I hope you could help me.
So I have instantiate “ValueDaño”, which is a Text. I want to add every new instance of “ValueDaño” to the array “Textos”, so I can control their position with the foreach loop until each one is destroyed.
How can I do that??
public void NumDamages()
{
if (ValorVida != enemigo.GetComponent<enemigo>().Vida)
{
ValueDaño = Instantiate(textoD, Camera.main.WorldToScreenPoint(enemigo.position + offset2), transform.rotation);
Destroy(ValueDaño.gameObject, 3);
ValorVida = enemigo.GetComponent<enemigo>().Vida;
}
Text [] Textos;
foreach (Text item in Textos)
{
ValueDaño.transform.position += Vector3.up * ValorSubida * Time.deltaTime;
}
}