错误cs0029无法将int类型隐式转换为bool

-2 c#

我有以下代码:

GameObject g = Instantiate(gemPrefab,new 
isMatched = true;
for (int i = 0; rows.Count; i++) 
    {
        rows[i].isMatched = true;
    }
if (collumns.Count >= AmountToMatch)
    {
        isMatched=true;
    }
for(int i=0;collumns.Count;i++)
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误:

错误cs0029无法将int类型隐式转换为bool(107,25)和(115,25)

我怎样才能解决这个问题?

Mat*_*oss 5

for(...)表达式中的条件需要是布尔表达式.

而不是rows.Count,你的意思究竟是什么意思?可能i < rows.Count.

第115行的表达也是如此.你想要的i < collumns.Count.