我尝试过自定义功能:
if(Input.GetMouseButtonUp(0)) {
AcceptInput = true;
targetScript.enabled = false;
changeSprite ();
}
function changeSprite () {
//other stuff
}
有一个错误:
Assets/Scripts/Button.js(70,1): BCE0070: Definition of 'Button.changeSprite()'
depends on 'Button.changeSprite()' whose type could not be resolved because of
a cycle. Explicitly declare the type of either one to break the cycle.
我不知道这个功能有什么问题。任何人都可以帮助我吗?
答案 0 :(得分:1)
正如错误消息告诉我们的那样,您可以尝试定义函数的返回类型,在本例中为“void”;
function changeSprite(): void {
//other stuff
}