c# - 脚本错误:';' 预期的。统一错误
问题描述
在遵循教程时,我在此脚本上遇到此错误
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
public GameObject prefab;
// Instantiate the Prefab somewhere between -10.0 and 10.0 on the x-z plane
void Start()
{
Vector3 position = new Vector3(Random.Range(-10.0f, 10.0f), 0, Random.Range(-10.0f, 10.0f))
Instantiate(prefab, position, Quaternion.identity)
}
}
解决方案
语句需要以;
语句可以由以分号结尾的单行代码组成,也可以由块中的一系列单行语句组成
Vector3 position = new Vector3(...); <== note the semicolon
Instantiate(...); <== note the semicolon
这是错误告诉你的
推荐阅读
- c - 如何不在c中打印重复的组合
- javascript - 如何使用文本框表单 Javascript 添加开放式问题
- c# - 如何避免使用 Windows 窗体 C# 增加 onLoad 内容的内存?
- java - 使用 Apache Beam 的 Fixed Windowing 仅触发一次元素
- flutter - 在颤振网页中心对齐多个按钮
- java - 如何在 JFrame 中显示图像?
- mongodb - 更新嵌套数组的字段时,如何使 mongodb 的“更新”停止?
- c# - 如何防止在 Unity 中运行游戏时禁用游戏对象?
- xml - 使用 XSLT 删除重复标记及其在 XML 中的子项
- sql - SQL 按拆分数据分组