Unity is protesting. It gives me the error: Use of unassigned local variable `att’. It gives the error for the return-line, not for the line in the if-statement.
In some cases like if you have a local variable declaration inside a code-block you can sometimes get this error, but I can’t see how this function can not see the declaration. Anyone have any ideas? What am I not seeing? Thanks!
public cBaseStats GetAttribute(string name)
{
int cnt;
cBaseStats att;
for (cnt = 0; cnt < _attrib.Length; cnt++)
{
if (_attrib[cnt].Name == name)
att = _attrib[cnt];
}
return att;
}