所以我有以下代码片段:
void OnCollisionExit (Collision hit) {
print(hit);
print(creator.GetComponent<CreateTrail>().trigger);
print(GetComponent<Renderer>().enabled);
b = this.GetComponents<Behaviour>();
r = this.GetComponents<Renderer>();
c = this.GetComponents<Collider>();
GetComponent<Renderer>().enabled = true;
foreach (Behaviour c in b)
{
c.enabled = true;
}
foreach (Renderer c in r)
{
c.enabled = true;
}
foreach (Collider c in c)
{
c.enabled = true;
}
}
}
发生事件,并且前两行执行正常,将预期的输出打印到控制台,但是随后它停止了吗?为什么?该代码应该打印一些调试内容,然后将所有这些启用的属性设置为true。