unity 5.0 C#写这个程序,发现匿名函数全报错了,附:错误提示
GetComponent<Button>().onClick.AddListener( ()=>{
mainLoop.OnClick(this);
});
错误提示:
Assets/Script/Title.cs(15,49): error CS1593: Delegate `UnityEngine.Events.UnityAction<UnityEngine.UI.Button>' does not take `0' arguments
请问这是什么原因,unity5.0不支持匿名函数吗?
大家看一看,问题出在哪里呢?
UnityAction<UnityEngine.UI.Button> 有个参数的呀。
button=>{};
UnityEngine.Events.UnityAction<UnityEngine.UI.Button>' does not take `0' arguments,这句话的意思,说明UnityEngine,不接受0个参数的委托,意思是带参数的,你F12 进去看看