More loop problems

private bool loopBool = 3;

Script 1
public void ActivateScript1(){

int i = 0;

if(!loopBool*){*

Script2.ActivateScript2();
}

for (; i < max; i++)
{
loopBool = true;
}
}

Script 2

public void ActivateScript2(){
foreach (var item in collection)
{
Debug.Log(“A”);
}
}

ActivateScript1 is activated via a button. I want it so that if I press the button the debug message appears. Then I want that slot in the boolArray to turn true. And it should do this max 3 times since that is the size of the bool array.
Unfortunately as is now the first slot turn true and nothing happens after I press the button again. I know this might seem complicated ask for info if you are confused.

hello,
what do you mean about “nothing happens after I press the button again”?


Is the problem doesn’t appear again? if it is because after slot [0] (cause ‘i’ is zero ) going to be true after that that it’s never back to false, you must set it false to make it work again.


or the problem is doesn’t make slot [1] and [2] true?
if it’s that you mean, that because you are never set “i” to slot that you want to be changed.


Hope it help.