Can I instantiate GameObjects via constructor?

So I have a GameManager GameObject that persists throughout my scenes, and when the game is launched, it is responsible for creating and keeping reference to one or many GameObjects called Player.

Now, I want two different types of Player - human Players, and CPU Players.

The easy part is, in my GameManager object, I create a new public variable, which I can pass the Player prefab. But the problem is, my CPU Player might have different or additional attributes and methods - but I still want it to be based off my Player prefab.

So ideally, I want to instantiate my Player prefab, but with a constructor, like Player(true) or Player(false) depending on if it’s a CPU player or not.

I guess another way of putting this is:

If I have a Prefab, and I pass that Prefab as a public variable into another GameObject - when I call Instantiate(mypublic var, …) will it also call that Prefab’s constructor if I attach a script and define one?

No, not as written.

What you can do is use a factory pattern. Something like this. Basically its a wrapper method on Instantiate that behaves a little more like a traditional constructor.

public class MyClass (){
    static public GameObject MakeObject(bool isPlayer){
        GameObject clone = (GameObject)Instantiate(playerPrefab);
        clone.GetComponent<Controller>().isPlayer = isPlayer;
        return clone;
    }
}