【问题标题】:cs1513 c# expected unityc# 期望统一 cs1513
【发布时间】:2016-12-16 08:05:56
【问题描述】:

大家好,我是 Unity 脚本的新手,我无法解决这个问题,请有人帮助我

代码如下:

using UnityEngine;
using System.Collections;

public class testScript  : MonoBehaviour
{
    int i = 1;
    // Use this for initialization
    void Start()
    {

        for (i = 1; i > 6; i++)
        {

            Debug.Log("value of i = " + i);

        }

        Debug.Log("i'm out of the loop");

    } //the problem is cs1513 c# expected unity here(21.line)

    // Update is called once per frame
    void Update()
    {

    }

我正在使用 Microsoft Visual Studio 的程序

提前致谢!!!

【问题讨论】:

    标签: c# unity3d scripting


    【解决方案1】:

    您只在脚本末尾缺少}。最后一个} 应该关闭类{。这很可能是您误删的。有时,Unity 无法识别脚本更改。如果进行此修改后问题仍然存在,只需关闭并重新打开 Unity 和 Visual Studio/MonoDevelop。

    using UnityEngine;
    using System.Collections;
    
    public class testScript  : MonoBehaviour
    {
        int i = 1;
        // Use this for initialization
        void Start()
        {
    
            for (i = 1; i > 6; i++)
            {
    
                Debug.Log("value of i = " + i);
    
            }
    
            Debug.Log("i'm out of the loop");
    
        } //the problem is cs1513 c# expected unity here(21.line)
    
        // Update is called once per frame
        void Update()
        {
    
        }
    }//<====This you missed.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-09
      相关资源
      最近更新 更多