错误日志:MissingReferenceException: The object of type 'Button' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.EventSystems.UIBehaviour.IsActive () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/UIBehaviour.cs:22)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:32)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:45)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHan
报错: The object of type 'Button' has been destroyed but you are still trying to access it
最新推荐文章于 2024-07-28 19:26:03 发布
在Unity3D中遇到'Button'对象已被销毁但仍尝试访问的MissingReferenceException错误。错误源于UIBehaviour.IsActive()方法。解决方案是确保脚本检查对象是否为null,或者避免销毁对象。具体实例中,将TestClick脚本的显示顺序移至Button脚本下方可解决问题。
摘要由CSDN通过智能技术生成