cannot convert from 'method group' to 'game object'

So basically I get this error “cannot convert from ‘method group’ to ‘game object’”
But I absolutely have no idea why, because I do return back a GameObject, I don’t know what’s bothering Unity :frowning:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bulletRandSpawn : MonoBehaviour {

    public GameObject topPanel, bottomPanel, leftPanel, rightPanel, bulletGO;

    void Update() {
        SpawnABullet();
    }

    private static Vector2 RandomPointInBox(GameObject nameOfBox) {
        float boxXSize = nameOfBox.GetComponent<Renderer>().bounds.size.x;
        float boxYSize = nameOfBox.GetComponent<Renderer>().bounds.size.y;

        Vector2 center = new Vector2(boxXSize / 2, boxYSize / 2);

        return center + new Vector2(
           (Random.value - 0.5f) * boxXSize,
           (Random.value - 0.5f) * boxYSize
        );
    }

    private void SpawnABullet() {
        Vector2 randPoint = RandomPointInBox(randomPanelSelector);
        Instantiate(bulletGO, randPoint, Quaternion.identity);
    }

    private GameObject randomPanelSelector() {
        int randNum = Random.Range(1, 4);

        switch (randNum) {
            case 1:
                return topPanel;

            case 2:
                return bottomPanel;

            case 3:
                return leftPanel;

            case 4:
                return rightPanel;

            default:
                return topPanel;
        }
    }
}

Line 26 should probably be changed to this:

Vector2 randPoint = RandomPointInBox(randomPanelSelector());

Just want to point out that randomPanelSelector() will never return “rightPanel” as written. You need to change to Random.Range(1, 5) for it to be able to return a 4 due to the max value given being exclusive not inclusive.

Oh wow, how the hell I missed brackets? It’s like when you have millions of lines of code and somewhere ‘;’ is missing and you don’t have console :\ Thanks for the help, I appreciate that you can take my stupidity hahaha, sorry, but I am a beginner :slight_smile: