IEnumerator ModifyAttributesWhenKeyPressed()
{
while(unspentSkillPoint>0)
{
bool pressed = false;
while(!pressed)
{
if(Input.instance.RiseAttribute_1||Input.instance.RiseAttribute_2||
Input.instance.RiseAttribute_3||Input.instance.RiseAttribute_4||
Input.instance.RiseDeffensiveAttributes|| Input.instance.RiseDeffensiveAttributes)
{
pressed=true;
}
yield return null;
}
if(DeffensiveAttributesPanel.activeInHierarchy)
{
if(Input.instance.RiseAttribute_1)
{
//+att here
unspentSkillPoint--;
}
else if(Input.instance.RiseAttribute_2)
{
//+att here
unspentSkillPoint--;
}
else if(Input.instance.RiseAttribute_3)
{
//+att here
unspentSkillPoint--;
}
else if(Input.instance.RiseAttribute_4)
{
//+att here
unspentSkillPoint--;
}
else break;
}
else if(OffensiveAttributesPanel.activeInHierarchy)
{
if(Input.instance.RiseAttribute_1)
{
//+att here
unspentSkillPoint--;
}
else if(Input.instance.RiseAttribute_2)
{
//+att here
unspentSkillPoint--;
}
else if(nput.instance.RiseAttribute_3)
{
//+att here
unspentSkillPoint--;
}
else if(Input.instance.RiseAttribute_4)
{
//+att here
unspentSkillPoint--;
}
else break;
}
}
print("end ;oop");
DeffensiveAttributesPanel.SetActive(false);
OffensiveAttributesPanel.SetActive(false);
AttributesPanel.SetActive(true);
}
This is my coroutine. All I want is these 4:
print("end ;oop");
DeffensiveAttributesPanel.SetActive(false);
OffensiveAttributesPanel.SetActive(false);
AttributesPanel.SetActive(true);
keep standing still until unspentSkillPoints reaches 0 or the menus are closed, but instead, they start even when unspentSkillPoint is >0. The question is: do I misunderstand the coroutine- instead of the normal order in nested loops, it ends the outside loop too? Thank you for your time, I really appreciate it.