- Home /
Use of boolean functions in c#
I want to make a function in the same class, that checks if a specific transforms childcount is 1 and if so, it should return true. Now I wanted to use that function in an if-statement I get the strange error: "Cannot convert method group IsWeaponMode' to non-delegate type
bool'. " What am I doing wrong?
public bool IsWeaponMode() { if(Weaponobject.childCount == 1) return true; else return false; }
//code in void Update if (IsWeaponMode) { Animationen.CrossFade("Walk_Weapon"); return; }
Answer by · Apr 29, 2011 at 12:12 PM
It's a function, not a variable. I think you want:
if ( IsWeaponMode() )
{
Animationen.CrossFade("Walk_Weapon");
return;
}
Thanks. I thought I could use it the same way it is in JS :D
Your answer
Follow this Question
Related Questions
If function Question 1 Answer
Questions of the Coroutines 1 Answer
How can I use a yeild during an udate? 1 Answer
check bool in WaitForSeconds 2 Answers