Instantiate Object NOT WORKING.

I absolutely have tried 4 straight hours of variations of this stupid instantiation technique. I have searched and searched, and this is still not working. Here’s the code (C#):

	public GameObject[] playerObjectSkins;	 //this has 4 prefab items plugged into it from inspector

void Start () {
		int playerObjectRandomizer = Random.Range (0,3);										//randomized player skin selection
		GameObject playerSkin;
		playerSkin = Instantiate(playerObjectSkins, transform.position, transform.rotation) as GameObject;			//playerSkin Object
		if(playerObjectRandomizer == 0) {playerSkin = playerObjectSkins[0];}
		if(playerObjectRandomizer == 1) {playerSkin = playerObjectSkins[1];}
		if(playerObjectRandomizer == 2) {playerSkin = playerObjectSkins[2];}
		if(playerObjectRandomizer == 3) {playerSkin = playerObjectSkins[3];}

}

If anyone has help, I would greatly appreciate it.

playerObjectSkins is an array of GameObject’s. playerSkin is a single GameObject.

The problem is you are passing a complete array in the Instantiate() method and not a single entity.

This following corrects all that and returns a randomly selected prefab.

public GameObject[] playerObjectSkins;  //this has 4 prefab items plugged into it from inspector

void Start ()
{
    GameObject playerSkin = null;

    if (playerObjectSkins.Length > 0)
    {
        int playerObjectRandomizer = Random.Range (0, playerObjectSkins.Length);  //randomized player skin selection
        playerSkin = Instantiate(playerObjectSkins[playerObjectRandomizer], transform.position, transform.rotation) as GameObject;  //playerSkin Object
    }
}