Answer the question
In order to leave comments, you need to log in
Why is nothing written to the array?
Why is nothing written to the array? Everything is output by zeros
Here is the code:
void Start() {
StartTest = StartCoroutine(TestCheck());
}
IEnumerator TestCheck()
{
while(true)
{
float[] StartSide = new float[(int)Abc.transform.localScale.x];//массив координат начал сторон
float[] EndSide = new float[(int)Abc.transform.localScale.x];//массив координат концов сторон
if(stoped == false)
{
for(int i = 0; i <= (Abc.transform.localScale.x - 1);i++)
{
print("Граница [" + i + "]стороны = [" + (Abc.transform.position.x - (Abc.transform.localScale.x/2 - 1 * i)) + ";" + (Abc.transform.position.x - (Abc.transform.localScale.x/2 - ((1 * i) + 1)) + "]"));
StartSide[i] = Abc.transform.position.x - (Abc.transform.localScale.x/2 - 1 * i);
EndSide[i] = Abc.transform.position.x - (Abc.transform.localScale.x/2 - ((1 * i) + 1));
if(i == (Abc.transform.localScale.x - 1f)) stoped = true;
}
}else
{
for(int a = 0; a <= (Abc.transform.localScale.x - 1);a++)
{
print("Else - " + StartSide[a]);
if(a == (Abc.transform.localScale.x - 1f)) StopCoroutine(StartTest);
}
}
yield return new WaitForSeconds(1f);
}
}
Answer the question
In order to leave comments, you need to log in
The solution to the problem was simple. It was necessary to write arrays before while
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question