2021.07.04 GoogleMobileAds.Unity.RewardingAdBaseClient:CreateButtonBehavior() 發生 " You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all
UnityEngine.MonoBehaviour:.ctor()
ButtonBehaviour:.ctor() " 錯誤,雖然不會影響結果但是改一改總是好的。
解決方法為將 RewardingAdBaseClient 內的
buttonBehaviour = new ButtonBehaviour();
改為:
GameObject ob=new GameObject();
ob.AddComponent<ButtonBehaviour>();
buttonBehaviour = ob.GetComponent<ButtonBehaviour>();
即可。
沒有留言:
張貼留言