c# - 统一的 C# 的 CS1519
问题描述
我是编码新手,遇到了代码错误,我不确定如何修复它。我正在使用 unity 2018,它告诉我-
错误 CS1519:类、结构或接口成员声明中的标记“=”无效
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AutoCookies : MonoBehaviour {
public bool CreatingCookie = false;
public static CookieIncrease = 1;
public int InternalIncrease;
void Update() {
InternalIncrease = CookieIncrease;
if (CreatingCookie == false)
{CreatingCookie = true;
StartCoroutine(CreateTheCookie());
}
}
IEnumerator CreateTheCookie ()
{
GlobalCookie.CookieCount += InternalIncrease;
yield return new WaitForSeconds(1);
CreatingCookie = false;
}
}
我查看了错误的实际含义,并尝试修复它,但没有成功。该代码旨在为我正在为我的 12 年主要作品编码的游戏自动创建 cookie。
解决方案
正如丹尼尔怀特所说,public static CookieIncrease = 1;
是问题所在。
CookieIncrease 没有类型定义。
public static int CookieIncrease = 1;
可能是你想要的。
推荐阅读
- wordpress - 无需修改,wordpress 网站上的 Pagespeed 分数每天都在下降
- r - 用 tidyverse 总结长格式数据框中的两个变量
- c# - 在手机上启动 Xamarin 应用程序时出现 Visual Studio 错误
- json - 如何检查 Redshift Spectrum 中的结构不为空?
- javascript - 如何在 JSON 文件中导出对象数组,然后使用 es6 导入
- typescript - 是否可以推断类型参数的类型?
- reactjs - 如何使用
, 用于分解 Ant Design 中的组件 我想为 Ant Design Table 中的行创建一个组件,其中每个组件都有自己的状态,并基于该表显示行。可能吗?
如果可能的话,我该怎么做?一个例子会有所帮助。
我尝试了以下示例,但显示“无数据”
在 item.js 中
import Rea
- sql - 如何在连续日期中查找特定值
- python - Python 3 子进程 SIGABRT
- tensorflow - 如何将keras模型转换为tpu模型