我在Unity中为敌人编写AI代码,但是Unity给了我这个错误。它说错误在第21行,但是我找不到它。任何帮助都是感激的!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyController : MonoBehaviour
{
public float lookRadius = 10f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
void OnDrawGizmosSelected()
{
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(transform.position, lookRadius);
}
1条答案
按热度按时间vuktfyat1#
在空的
Update()
函数后面有一个不属于这里的右括号,它应该在OnDrawGizmosSelected()
下面,这样它就可以包含EnemyController
类,如下所示: