c# - 创建 float 时出现意外符号 'public'

标签 c# error-handling symbols

关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。












想改进这个问题?将问题更新为 on-topic对于堆栈溢出。

5年前关闭。




Improve this question




我是统一的新手,但是每当我创建变量时都会出现错误。

它说错误 cs1525:意外符号“公共(public)”

这是我的脚本

using UnityEngine;
using System.Collections;

public class move : MonoBehaviour
{

    // Use this for initialization
    void Start ()
    {
        public float speed = 3.0f;
    }

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

    }
}

最佳答案

类成员应该在类 block 内定义,但在方法之外。

将所有“公共(public)”行移到“void Start()”行上方。

关于c# - 创建 float 时出现意外符号 'public',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39432209/

相关文章:

common-lisp - 关键字命名空间污染

c# - 有没有一种技术可以将 DebugFormat() 与构建起来很昂贵的参数一起使用?

C# 重载方法错误

c# - 为什么 C++ fseek/fread 的性能是 C# FileStream 的 Seek/Read 的数倍

c# - 在 c# 中的 asp.net 标签前添加空格

python - 类型错误 : expected a character buffer object

api - Yahoo Finance API 股票/股票代码查找只允许完全匹配

pandas - 从excel加载数据时出现python _getitem_和_getitem_column(key)错误

r - 在栅格::calc中的tryCatch r

javascript - 在 ES6 中,如何覆盖父类(super class)中的私有(private)方法?