Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Athin on April 15, 2021, 07:29:37 AM

Title: UI Drag Event Error
Post by: Athin on April 15, 2021, 07:29:37 AM
Hey guys,

I've been making a UI Inventory system with the canvas and came across an odd error that may be a bug?  For testing purposes, I've made a new scene and created a UI Button within the canvas.  I've made a FSM on the button with the first state containing a UI On Drag Event and a UI On Pointer Up Event.  Each event just fires off to a state that just waits 1 second and returns to the first listening state again.

When you run this, as soon as you try to drag across the button an "ArgumentOutOfRangeException" fires off?  I've not sure what array it is pointing to as there is nothing even happening like this.  Is this a bug or am I using the actions incorrectly?

I basically want to tell if the player selects an item or drags an item and I thought this was a simple way to check if they are dragging or clicking but clearly not.  Any advise on the error or better way of doing this?
Title: Re: UI Drag Event Error
Post by: Alex Chouls on April 15, 2021, 02:41:32 PM
Can you copy/paste the full error from the console?
Title: Re: UI Drag Event Error
Post by: Athin on April 16, 2021, 06:43:09 AM
Hey Alex.

See below for the full error log.  Can also repro it fairly easy with what I did above

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
UnityEngine.EventSystems.EventTrigger.Execute (UnityEngine.EventSystems.EventTriggerType id, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2020.2.7f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventTrigger.cs:218)
UnityEngine.EventSystems.EventTrigger.OnPointerDown (UnityEngine.EventSystems.PointerEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2020.2.7f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventTrigger.cs:257)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerDownHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2020.2.7f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:36)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/Program Files/Unity/Hub/Editor/2020.2.7f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:262)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2020.2.7f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:385)
Title: Re: UI Drag Event Error
Post by: Alex Chouls on April 16, 2021, 07:33:11 PM
I couldn't repro the error. I've attached my setup. Is that what you have?

The pasted error actually doesn't show any PlayMaker scripts in the call stack, it looks like an EventSystem error generated by OnPointerDown. Are you sure this is the error you're getting when dragging over the button?
Title: Re: UI Drag Event Error
Post by: Athin on April 16, 2021, 11:17:51 PM
https://imgur.com/a/WJiuwXp

I've used the actual actions like above instead of the events.  This has 100% repro for me to get this error
Title: Re: UI Drag Event Error
Post by: djaydino on April 17, 2021, 09:22:10 AM
Hi.
I tried on Unity 2018.4 LTS with latest playmaker 1.9.1p4
and on unity 2020.3.3f1

But i can't repo this either.

Do you have something in state 9/10

What unity / playmaker version are you using?
Title: Re: UI Drag Event Error
Post by: Athin on April 17, 2021, 07:30:27 PM
Hey guys

Lucky me with this error then!

Unity version: 2020.2.7f1
Playmaker: 1.9.0.P17

The scene is empty minus the one button and those actions.  The only other actions I got is a wait action to stop the endless loop in state 9/10.  Even if I remove those, I still get the error.
Title: Re: UI Drag Event Error
Post by: djaydino on April 18, 2021, 09:39:57 AM
Hi.
Can you try updating playmaker.

Before you do Always make a backup of your project.