Question by
freedom667 · Mar 07, 2018 at 08:17 AM ·
unity 5collider2dstringcontainsif-else
if a string contains any string
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
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Error FormatException: Input string was not in a correct format. 0 Answers
Dash through enemies and dont taking damage 3 Answers
Building tycoon game, need help storing variables into an array. 1 Answer
Developer Console problems..... (in-game console) 0 Answers
How to change size of collider attached to UI Image. 0 Answers