playMaker

Author Topic: Arraymaker "Array list sort" why cant I just sort the list one time and move on?  (Read 3708 times)

upOwlNight

  • Playmaker Newbie
  • *
  • Posts: 27
I'm using array list sort. I need to sort the list, then use array list get. My problem is if there is "array list sort" in my action I can't go past it.

My next action is send event but it never gets there. I hit pause and look inside the FSM and I see Array list sort with a green checkbox, which I thought meant it was happening every frame. How do I get to the next action when using an array list sort?
« Last Edit: May 14, 2014, 06:37:49 PM by upOwlNight »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 ok, I double checked the sort action and it does fire a finish call.

BUT you have lots of errors in Unity console, I am sure this is the problem, not the actual Fsm itself or it's flow. IT's important to know that if an error is thrown in the Unity console some code following the error will nto be called and so bugs the whole application.

 CAn you paste the errors you get? that's what needs to be solved first.

what is the content of the arraList you are trying to sort? so that I can try locally

Bye,

 Jean

upOwlNight

  • Playmaker Newbie
  • *
  • Posts: 27
every array list I am using uses Vector 3. This is what I get in console (I think this is all one error)

InvalidOperationException: No IComparable or IComparable<System.Object> interface found.
System.Array.compare[Object] (System.Object value1, System.Object value2, IComparer`1 comparer) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Array.cs:1755)
System.Array.qsort[Object,Object] (System.Object[] keys, System.Object[] items, Int32 low0, Int32 high0, IComparer`1 comparer) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Array.cs:1721)
System.Array.Sort[Object,Object] (System.Object[] keys, System.Object[] items, Int32 index, Int32 length, IComparer`1 comparer) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Array.cs:1674)
Rethrow as InvalidOperationException: The comparer threw an exception.
System.Array.Sort[Object,Object] (System.Object[] keys, System.Object[] items, Int32 index, Int32 length, IComparer`1 comparer) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Array.cs:1677)
System.Array.Sort[Object] (System.Object[] array, Int32 index, Int32 length) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Array.cs:1608)
System.Collections.ArrayList.Sort () (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Collections/ArrayList.cs:3185)
HutongGames.PlayMaker.Actions.ArrayListSort.DoArrayListSort () (at /Users/R2D2/Dropbox/ColorSavvy_4.0/Assets/PlayMaker ArrayMaker/Actions/ArrayList/ArrayListSort.cs:48)
HutongGames.PlayMaker.Actions.ArrayListSort.OnEnter () (at /Users/R2D2/Dropbox/ColorSavvy_4.0/Assets/PlayMaker ArrayMaker/Actions/ArrayList/ArrayListSort.cs:37)
HutongGames.PlayMaker.FsmState.ActivateActions (Int32 startIndex)
HutongGames.PlayMaker.FsmState.OnEnter ()
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState)
HutongGames.PlayMaker.Fsm.UpdateStateChanges ()
HutongGames.PlayMaker.Fsm.LateUpdateState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.LateUpdate ()
PlayMakerFSM.LateUpdate ()

upOwlNight

  • Playmaker Newbie
  • *
  • Posts: 27
it never even crossed my mind, but can you not sort a vector 3 array? I guess I don't actually know what sort does  :-[

upOwlNight

  • Playmaker Newbie
  • *
  • Posts: 27
It seems I've fixed my problem. You're reply tipped me off on what to look for Jean, Thanks. I had to write a whole new process to give my sort action something it can actually sort, but I'm afraid my method is too clunky. I was hoping for some suggestions, so I made a post in the general board. Here is a link for anyone who might be interested.
http://hutonggames.com/playmakerforum/index.php?topic=7317.0

If anyone has anything to say about the link, please reply in that topic :)