OnPointerEnter/Exit not working on instantiated objects in build
As the title suggests, I've got some UI elements in an inventory. OnPointerEnter/Exit are working fine on the initially created ones in build and editor. When additional slots are instantiated in editor it all works fine, but when additional slots are instantiated in build I'm getting the following error:
Exception NullReferenceException: Object reference not set to an instance of an object InventorySlot.OnPointerEnter (UnityEngine.EventSystems.PointerEventData eventData) (at :0) UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerEnterHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at :0) UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at :0) UnityEngine.EventSystems.EventSystem:Update()
And a similar one for OnPointerExit. Is there something I should be doing to make eventdata work in the build? Any help appreciated!
Your answer
Follow this Question
Related Questions
Simple game lags while in editor but runs fine when build 1 Answer
NullReferenceError in Build but not the Editor,NullReferenceException in Build but not Editor. 0 Answers
Error with Instantiate after build 0 Answers
Prefabs not instantiating after build 0 Answers
How to spawn a prefab at a duplicate objects location 1 Answer