2015-03-13 94 views
-2

我有以下代码:错误CS0029不能隐式转换int类型为bool

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++) 

不过,我得到以下错误:

error cs0029 cannot implicitly convert type int to bool (107,25) and (115,25)

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

+0

cs2009似乎是一个C#错误消息,这是有道理的,因为如果这是C++,它*应该*编译,但仍然是错误的。 – 2015-03-13 16:18:56

回答

5

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

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

第115行的表达也是如此。您需要i < collumns.Count

+0

非常感谢你)现在工作) – 2015-03-13 16:23:16

相关问题