i have a selection character script `using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class skinselect : MonoBehaviour
{
private GameObject skinlist;
public int index;
// Start is called before the first frame update
private void Start()
{
index = PlayerPrefs.GetInt("CharacterSelected");
skinlist = new GameObject[transform.childCount];
for(int i =0; i < transform.childCount; i++)
skinlist *= transform.GetChild(i).gameObject;*
foreach(GameObject go in skinlist)
{
go.SetActive(false);
if (skinlist[index])
skinlist[index].SetActive(true);
}
}
public void ToggleLeft()
{
skinlist[index].SetActive(false);
index–;
if (index < 0)
index = skinlist.Length - 1;
skinlist[index].SetActive(true);
}
public void Toggleright()
{
skinlist[index].SetActive(false);
index++;
if (index ==skinlist.Length)
index = 0;
skinlist[index].SetActive(true);
}
public void confirmbutton()
{
PlayerPrefs.SetInt(“CharacterSelected”, index);
}
}
and camera follow script
using UnityEngine;
public class camerafollow : MonoBehaviour {
public Transform player;
public float smoothSpeed = 0.125f;
public Vector3 offset;
void LateUpdate()
{
transform.position = player .position + offset;
}
}
but i dont know how to make the camera follow after the selected character