Whenever I try to run this script, it comes up with this error: error CS0122: `UnityStandardAssets.Utility.SmoothFollow.target’ is inaccessible due to its protection level. Also, the .target part of the void Update comes up with this error: error CS0117: ‘UnityStandardAssets.Utility.SmoothFollow’ does not contain a definition for ‘target’
How do I fix these problems? Here is my code:
ing System.Collections;
using System.Collections.Generic;
using UnityStandardAssets.Utility;
public class GameManager : MonoBehaviour {
public List Characters = new List();
List names = new List();
bool ShowCharWheel;
public int SelectedCharacter;
void Awake()
{
foreach (Character c in Characters)
{
c.Instance = Instantiate(c.PlayerPrefab,c.HomeSpawn.position,c.HomeSpawn.rotation) as GameObject;
}
}
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update () {
if (Input.GetKey (KeyCode.C)) {
ShowCharWheel = true;
}
else
{
ShowCharWheel = false;
}
Characters [SelectedCharacter].Instance.GetComponent<PlayerController> ().CanPlay = true;
Camera.main.GetComponent<SmoothFollow>().target = Characters [SelectedCharacter].Instance.transform;
}
void OnGUI()
{
if (ShowCharWheel)
{
GUILayout.BeginArea(new Rect(Screen.width - 64, Screen.height - 192,64,192));
foreach(Character c in Characters)
{
if(GUILayout.Button(c.Icon,GUILayout.Width(64),GUILayout.Height(64)))
{
SelectedCharacter = Characters.IndexOf(c);
}
}
GUILayout.EndArea();
}
}
}
[System.Serializable]
public class Character
{
public string Name;
public Texture2D Icon;
public GameObject PlayerPrefab;
public GameObject Instance;
public Transform HomeSpawn;
}
Thanks!