C# Unity教程,IEnumerator ShotEffect(),错误
[Unity版本5.6.1f1;Visual Studio 2017] 嗨, 我正在使用Raycast学习基本的Unity FPS教程。我打电话时出错了 私有IEnumerator效应 如下: 功能本地功能在C4中不可用。请使用语言版本7或更高版本 我该如何解决这个问题?这是从Unity教程复制/粘贴的。除了这种类型的呼叫,还有其他选择吗 您已经在更新函数中定义了ShotEffect。检查你的牙套C# Unity教程,IEnumerator ShotEffect(),错误,c#,debugging,unity3d,ienumerator,C#,Debugging,Unity3d,Ienumerator,[Unity版本5.6.1f1;Visual Studio 2017] 嗨, 我正在使用Raycast学习基本的Unity FPS教程。我打电话时出错了 私有IEnumerator效应 如下: 功能本地功能在C4中不可用。请使用语言版本7或更高版本 我该如何解决这个问题?这是从Unity教程复制/粘贴的。除了这种类型的呼叫,还有其他选择吗 您已经在更新函数中定义了ShotEffect。检查你的牙套 void Update() { if (Input.GetButtonDo
void Update() {
if (Input.GetButtonDown("Fire1") && Time.time > nextFire)
{
// Update the time when our player can fire next
nextFire = Time.time + fireRate;
// Start our ShotEffect coroutine to turn our laser line on and off
StartCoroutine(ShotEffect()); //**Call here**
// Create a vector at the center of our camera's viewport
Vector3 rayOrigin = fpsCam.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0.0f));
// Declare a raycast hit to store information about what our raycast has hit
RaycastHit hit;
}
} // Add brace here
private IEnumerator ShotEffect()
{
// Play the shooting sound effect
gunAudio.Play();
// Turn on our line renderer
laserLine.enabled = true;
//Wait for .07 seconds
yield return shotDuration;
// Deactivate our line renderer after waiting
laserLine.enabled = false;
}
void Update() {
if (Input.GetButtonDown("Fire1") && Time.time > nextFire)
{
// Update the time when our player can fire next
nextFire = Time.time + fireRate;
// Start our ShotEffect coroutine to turn our laser line on and off
StartCoroutine(ShotEffect()); //**Call here**
// Create a vector at the center of our camera's viewport
Vector3 rayOrigin = fpsCam.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0.0f));
// Declare a raycast hit to store information about what our raycast has hit
RaycastHit hit;
}
} // Add brace here
private IEnumerator ShotEffect()
{
// Play the shooting sound effect
gunAudio.Play();
// Turn on our line renderer
laserLine.enabled = true;
//Wait for .07 seconds
yield return shotDuration;
// Deactivate our line renderer after waiting
laserLine.enabled = false;
}