playMaker

Author Topic: Array List get Index  (Read 4011 times)

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Array List get Index
« Reply #15 on: March 11, 2020, 07:33:50 AM »
no, the ArrayList stays consistent between edit and runtime, it's the hasbtable that can be shuffle but it doesn't matter because you are using the key to access a value. Unfortunatly, that's a per design issue of the hashtable itself ( it doesn't enforce order on serialisation/deserialization)

Right, that's the hash table indeed. Do you think one day this issue could be solved, in theory?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Array List get Index
« Reply #16 on: March 13, 2020, 02:20:32 AM »
Hi,

 nop :) this is inherent to how .NET framework has designed hashtables, not how ArrayMaker was designed. it's more efficient because it's not taking any memory nor processing to enforce order where it's not needed.


Bye,

 Jean

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Array List get Index
« Reply #17 on: March 13, 2020, 07:17:44 AM »
Could it be possible to use Unity to control, through a layer (wrapping?) the Hash Table so as to graft some extra (UI) functions on it?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Array List get Index
« Reply #18 on: March 13, 2020, 08:16:29 AM »
Hi,

 yes, that could be possible, but again, I don't see the point since that's not how hashtables are meant to be used. How many hashtable keys do you have?

if order is important, use two arrayLists, and use the arraylist reference as the columns ID, then you fall back on your feet.

Bye,

 Jean

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Array List get Index
« Reply #19 on: March 14, 2020, 12:34:01 PM »
If you have many keys and they have a meaning, it makes sense and becomes practical that they can be ordered according to a specific logic (alphabet, groups, type, etc.) without having to move back and forth between this and an Array List.
Not only the order cannot be altered on a case by case basis, like sliding one key two slots up or down like it can be done for Unity Sorting Layers, because you can only edit a key and its value or add or remove one, so tough luck if for organizational purposes, you find that a given key you forgot or want to add would fit better if placed in, say, the twelfth position instead of slot 86... this is already annoying but then comes the unpleasant experience when the order is all flushed once you press Run.
Without knowing the intricacies of .NET, this has always been a sour source of confusion I would gladly do without if possible.
« Last Edit: March 18, 2020, 09:58:59 AM by Broken Stylus »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Array List get Index
« Reply #20 on: March 17, 2020, 04:39:48 AM »
Hi,

Yes, this is something that potentially can make it into a major overall of ArrayMaker interface.

Bye,

 Jean