playMaker

Author Topic: Sort an Array of Game objects by name  (Read 1539 times)

sofianehamza

  • Playmaker Newbie
  • *
  • Posts: 35
Sort an Array of Game objects by name
« on: April 29, 2019, 09:03:02 PM »
hello, I've been trying to use the sort array action with game objects it does not seem to work
is there a way to sort game objects alphabetically then reverse it
thanks in advance

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Sort an Array of Game objects by name
« Reply #1 on: May 21, 2019, 02:28:34 AM »
Hi,

 Are you using ArryMaker or the built in FsmArray?

I would use ArrayMaker anyway, and keep a hashtable with keys as names and values as gameobjects, then you can extract the keys, sort them the way you want, and when you want to access them in order, you use the sorted array, and then pick up the gameobject from the hashtable.

without hashtables, it's not possible, only via a custom actions.

Bye,

 Jean