playMaker

Author Topic: [SOLVED] Array List Order  (Read 2004 times)

AxelG

  • Playmaker Newbie
  • *
  • Posts: 34
[SOLVED] Array List Order
« on: October 16, 2019, 09:15:32 AM »
Hello,

I'm new at Playmaker, I'm currently testing some elements and I have an issue with my Array list. The order isn't good for what I need (I'm listing cubes that self add into a array variable).

I'd like them to be sorted by name or order in the scene.

Any idea how to do so?

Here's attached a screen to help visualize.

Best,
AxelG
« Last Edit: October 17, 2019, 10:04:17 AM by AxelG »

Infamous

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Array List Order
« Reply #1 on: October 16, 2019, 09:55:55 AM »
Hi,

Can you elaborate more on how they instantiate? If they are always these 5 cubes I would use “get next child” on the parent of the cubes and add them to the array that way. It will keep the order you have right now in the scene.

Then when you want to get them you can use the index number to get them from the array. Index starts at 0 so cube 1 will have index 0 and so on

Hope this help, I’m a beginner also, but this might solve your problem


AxelG

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Array List Order
« Reply #2 on: October 16, 2019, 10:25:09 AM »
Hi Infamous,
Thanks for your reply.

There won’t be always the same number of cubes. Though, the cubes are just for test purpose, I want to dynamically set a list of objects (panels in a canvas) that will have childs of their own.

Wouldn’t your method list their respective childs aswell?

Infamous

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Array List Order
« Reply #3 on: October 16, 2019, 10:49:23 AM »
No respective child’s won’t be added, just the child of the parent you specify

AxelG

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Array List Order
« Reply #4 on: October 16, 2019, 11:04:27 AM »
Oh okay, interesting. I’ll try that. But question, where eo I find get next child? I only have a Array Get and Get Next.

Infamous

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Array List Order
« Reply #5 on: October 16, 2019, 11:21:27 AM »
It’s a built in action in the action browser

AxelG

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Array List Order
« Reply #6 on: October 16, 2019, 08:03:58 PM »
I did try your method, but Get Next Child doesn’t let me store the objects in a Array, only in a Game Object variable :S

Any other idea?

Infamous

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Array List Order
« Reply #7 on: October 17, 2019, 03:32:24 AM »
Hi,

Here’s how to do it


- “Get next Child”
 Store object in a variable
Set  “loop event” as anything you like (you can name it anything)
Send the loop event to do “array add”
Specify the object to add as the variable you chose earlier
When array add is finished send it back to “get next child”


Also, don’t forget to add a “finish” event as well to the “get next child”


Hope this helps...

Cheers
« Last Edit: October 17, 2019, 04:05:11 AM by Infamous »

AxelG

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Array List Order
« Reply #8 on: October 17, 2019, 10:03:51 AM »
It did, works perfectly. I was missing the Add Array step. Thanks for your help.
Now new issues for a new topic haha