playMaker

Author Topic: Array List Remove Action Does Not Work Properly. Help! [SOLVED]  (Read 2294 times)

HyperExc

  • Playmaker Newbie
  • *
  • Posts: 21
So, I've noticed that when you use the actions Array List Remove, and Array List Remove At, it basically destroys the index with it's data assigned to it and renames the other indexes. This is not the way it should work. It's illogical.
Even though I've started working with Arrays recently it seems pretty straightforward. The action should remove the data from the index, but the index should remain empty, or atleast if it destroys the index it should not rename the other indexes, as this messes up the whole structure of the array.

Am I missing something here? I really need it to work the way described above. Or is there another way that this can be achieved? Thank you.
« Last Edit: June 03, 2015, 03:00:21 AM by HyperExc »

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: Array List Remove Action Does Not Work Properly. Help!
« Reply #1 on: June 02, 2015, 10:30:47 AM »
The index orders the data by number. When you add data into an array it adds it to a new index number so if you remove data it would reset the order of the array.

What you are looking for I believe is Array List Set. This will let you set something to -null-
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Array List Remove Action Does Not Work Properly. Help!
« Reply #2 on: June 02, 2015, 12:08:39 PM »
Hi,

 Indeed, you need to look at array like a a stack of cards for example, if you remove the third card, the cards above will move one index down ( the fourth card becomes now the third card).

Also, this action use the built it function in .net, you can look at the doc to get a better idea:

https://msdn.microsoft.com/en-us/library/system.collections.arraylist.removeat(v=vs.110).aspx

 Bye,

 Jean

HyperExc

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Array List Remove Action Does Not Work Properly. Help!
« Reply #3 on: June 03, 2015, 02:57:52 AM »
Thank you both!

I understand now. Also I've managed to make it work by simply adding an empty game object to the index right after I remove it's previous content so that it would keep the array order intact.