如果你遇到了:
Assets\Scripts\Game.cs(37,16): error CS0079: The event 'Button.onClick' can only appear on the left hand side of += or -=
ArgumentException: GetComponent requires that the requested component 'Button' derives from MonoBehaviour or Component or is an interface. UnityEngine.GameObject.GetComponent[T] ()
检查一下编译器是否给你自动加上了:
using UnityEngine.UIElenments;
正确的代码是:文章来源:https://www.toymoban.com/news/detail-609324.html
using UnityEngine.UI;
因为自己查不到 特此记录文章来源地址https://www.toymoban.com/news/detail-609324.html
到了这里,关于【Unity3D】button组件无法使用onclick与image组件无法改变属性(如fillAmount等)的解决办法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!