I am having a small error here while trying to access a car in the character selection script I did whatever i could but could not solve it can anyone please help me
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class CarSelector : MonoBehaviour
{
//Made gameobject of the character list
private GameObject characterList;
private int index;
private void Start()
{
index = PlayerPrefs.GetInt("Character Selection");
//added count to the child objects of the character list
characterList = new GameObject[transform.childCount];
//got the first character in the list
for (int i = 0; i < transform.childCount; i++)
{
characterList *= transform.GetChild(i).gameObject;*
}
//disabled the inactive child characters
foreach(GameObject go in characterList)
go.SetActive(false);
//toggle on the first character
if (characterList[index])
characterList[index].SetActive(true);
}