ploopl
1
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);
}
}
}
Look closer at the code in the tutorial you linked. You have an extra closing parenthesis after canPlaceMonster.