I am using a script by TheFaceGrabber; here’s the errors and script.
assets/Scripts/GameManager.cs(25,9): error CS1525: Unexpected symbol }' Assets/Scripts/GameManager.cs(34,28): error CS1519: Unexpected symbol
else’ in class, struct, or interface member declaration
Assets/Scripts/GameManager.cs(36,39): error CS1519: Unexpected symbol =' in class, struct, or interface member declaration Assets/Scripts/GameManager.cs(38,17): error CS0178: Invalid rank specifier: expected
,’ or `]’
Assets/Scripts/GameManager.cs(38,47): error CS8025: Parsing error
NOTE: I already tried multiple ways to fix this and I couldn’t see any problems
Script:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GameManager : MonoBehaviour {
public List<Character> Characters = new List<Character>();
bool ShowCharWheel;
public int SelectedCharacter;
int LastCharacter;
public static GameManager Instance;
void Awake()
{
}
// Use this for initialization
void Start ()
{
Instance = this;
foreach (Character c in Characters)
{
c.Instance = Instantiate (c.PlayerPrefab, c.HomeSpawn.position, c.HomeSpawn.rotation) as GameObject;
}
ChangeCharacter (Characters [0])
}
// 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 ChangeCharacter(Character c)
{
SequenceManager.Instance.StartCoroutine ("DoCharSwitch", c);
LastCharacter = SelectedCharacter;
SelectedCharacter = Characters.IndexOf (c);
Characters [LastCharacter].Instance.GetComponent<PlayerController> ().CanPlay = 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)))
{
ChangeCharacter(c);
}
}
GUILayout.EndArea();
}
}
}
[System.Serializable]
public class Character
{
public string Name;
public Texture2D Icon;
public GameObject PlayerPrefab;
public GameObject Instance;
public Transform HomeSpawn;
}