Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: bigPalooka on February 14, 2022, 09:24:05 PM

Title: UI On Pointer Click causing ArgumentOutOfRangeException
Post by: bigPalooka on February 14, 2022, 09:24:05 PM
Hi gang, I have a state on an FSM that uses both UI On Pointer Click and UI On Pointer Exit. When the UI object is clicked I get an ArgumentOutOfRangeException error. The game runs fine other than the error.

I've made a simplified version of the FSM to reproduce the error.
Note that if the 2 UI Pointer actions are switched, the Pointer Exit action becomes the one to cause the error.

Would really appreciate any help!

(https://i.imgur.com/9Bk8pxZ.png)

The full error text is:
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)
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
UnityEngine.EventSystems.EventTrigger.Execute (UnityEngine.EventSystems.EventTriggerType id, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2019.4.21f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventTrigger.cs:212)
UnityEngine.EventSystems.EventTrigger.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2019.4.21f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventTrigger.cs:271)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2019.4.21f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50)
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/2019.4.21f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2019.4.21f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:377)

Title: Re: UI On Pointer Click causing ArgumentOutOfRangeException
Post by: djaydino on February 14, 2022, 10:30:18 PM
Hi.
What unity/playmaker version are you using?
To find the exact version of playmaker goto "Playmaker/Help/About Playmaker..."
Title: Re: UI On Pointer Click causing ArgumentOutOfRangeException
Post by: bigPalooka on February 14, 2022, 10:56:40 PM
Hi! I'm on Playmaker version 1.9.3.f4
Unity 2019.4.21f1
Title: Re: UI On Pointer Click causing ArgumentOutOfRangeException
Post by: djaydino on February 15, 2022, 08:22:55 AM
Hi.
I can confirm the issue, i will report to Alex.

I never use them in a same state as i have the pointer in/out on a separate fsm.
because most of the time i want some interactions (for example change color, Scale with a tween, other things)

here's a sample of how i set this :

(https://i.imgur.com/inT2lIm.gif)
Title: Re: UI On Pointer Click causing ArgumentOutOfRangeException
Post by: bigPalooka on February 15, 2022, 06:58:19 PM
Thanks so much for checking that for me. Shame I can't do it my way but I like the logic in your FSMs, will happily steal that. Cheers!
Title: Re: UI On Pointer Click causing ArgumentOutOfRangeException
Post by: andymetoo on March 31, 2022, 01:30:43 AM
Nice! I thought I was crazy and was the only one. Has there been any update on this? I believe I'll also do the same and steal your logic to avoid the errors, though. :) Thank you.
Title: Re: UI On Pointer Click causing ArgumentOutOfRangeException
Post by: andymetoo on December 18, 2022, 03:34:28 AM
Hello, I'm back again  :P. Any updates or word on this issue?
Title: Re: UI On Pointer Click causing ArgumentOutOfRangeException
Post by: djaydino on December 18, 2022, 03:36:00 AM
Hi.
Have you tried the latest Pm version :)
Title: Re: UI On Pointer Click causing ArgumentOutOfRangeException
Post by: andymetoo on December 18, 2022, 08:53:13 PM
Hello, no I haven't tried the one that just came out. I  reworked it using the system that you had above, which works just fine, but I was jw. I'll check it out when I get a sec. Thank you.