I want to do if first child's string contains any child's string, then enable colliders of these same strings. For example: zero element's string and (what if) fourth element's string are same. then these string's collider will enable. How can i do it?
if (letterPanel.childCount > 0)
{
string letter = letterPanel.GetChild(0).GetComponent<TextMeshPro>().text;
letterPanel.GetChild(0).GetComponent<CircleCollider2D>().enabled = true;
for (int i = 0; i < letterPanel.childCount; i++)
{
if (letter.Contains(letterPanel.GetChild(i).GetComponent<TextMeshPro>().text))
{
//enable colliders that same strings
}
else
{
//stay as disable except zero element's collider
}
}
}
Aucun commentaire:
Enregistrer un commentaire