2016-04-05 26 views
0

因此,今天即时制作需要游戏管理员的游戏,并且我无法缝合以找出代码无法工作的原因, 我遇到了另一个错误,下面 谁能告诉我,也许在那里我已经错了,帮我解决这个 错误资产/脚本/ GameManager.cs(37,1):错误CS8025:解析错误

Assets/Scripts/GameManager.cs(30,41): error CS1525: Unexpected symbol `{' 
Assets/Scripts/GameManager.cs(37,1): error CS8025: Parsing error` 




using UnityEngine; 
using System.Collections; 
using System.Collections.Generic; 
public class GameManager : MonoBehaviour { 
public List<Character> Characters = new List<Character>(); 
bool ShowCharWeel; 
public int SelectedCharacter; 
// Use this for initialization 
void Start() { 
} 
// Update is called once per frame 
void Update() { 
    if (Input.GetKeyDown (KeyCode.C)) 
    { 
     ShowCharWeel = true; 
    } 
} 
//controls the weel for characactor change// 
void OnGUI() 
{ 
    if (ShowCharWeel) 
    { 
     GUILayout.BeginArea(new Rect(Screen.width - 256, Screen.height - 256, 512, 512),GUIContent.none, "box"); 
     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; 
} 

回答

0

这个现在已修正,即时通讯抱歉耽误你的时间,再次观看我的代码后愚蠢地注意到一个错误

if (GUILayout.Button(c.Icon,GUILayout.Width(64),GUILayout.Height(64)() 

应该是

if (GUILayout.Button(c.Icon,GUILayout.Width(64),GUILayout.Height(64)))