C# 脚本错误:'';预期。单位误差
在学习教程时,我在这个脚本上出现了这个错误C# 脚本错误:'';预期。单位误差,c#,unity3d,C#,Unity3d,在学习教程时,我在这个脚本上出现了这个错误 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() {
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位置=新的Vector3(…) 这就是脚本的外观
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);
}
}
记住在这行的末尾加“;”
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);
}
}
这是c#
。。。每个语句都以结尾代码>。。。在开始Unity开发之前,也许你应该先学习一些基本的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);
}
}