【发布时间】:2022-07-28 00:41:49
【问题描述】:
这似乎是一个错字,但事实并非如此。如果你仔细观察,你会看到一个私有对象 l;。这样做是因为 != 会导致许多其他错误。之前还好好的,现在就开始不正常了。
private object l;
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0))
{
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit))
{
BoxCollider bc = hit.collider as BoxCollider;
if (bc) l = null;)
{
Destroy(bc.gameObject);
}
}
}
}
【问题讨论】:
-
if (bc) l = null;)- 这是一个错字。
标签: c# unity3d game-development unityscript