- Home /
Question by
ploopl · Jan 03, 2016 at 09:04 AM ·
boolif statement
Cannot convert method group 'xxxxxxxxxxx' to non-delegate type bool.
New to programming and need help with an error at line 10; Cannot convert method group 'xxxxxxxxxxx' to non-delegate type bool. I'm learning from this tutorial page.
public class PlaceMonster : MonoBehaviour {
public GameObject MonsterPrefab;
private GameObject Monster;
private bool canPlaceMonster()
{
return Monster == null;
}
void OnMouseUp()
{
if (canPlaceMonster) ())
{
Monster = (GameObject)
Instantiate(MonsterPrefab, transform.position, Quaternion.identity);
AudioSource audioSource = gameObject.GetComponent<AudioSource>();
audioSource.PlayOneShot(audioSource.clip);
}
}
}
Comment
Best Answer
Answer by OncaLupe · Jan 03, 2016 at 08:35 PM
Look closer at the code in the tutorial you linked. You have an extra closing parenthesis after canPlaceMonster.
Thanks for the extra pair of eyes, what a silly mistake :)
Your answer