Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: AxelG 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
-
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
-
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?
-
No respective child’s won’t be added, just the child of the parent you specify
-
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.
-
It’s a built in action in the action browser
-
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?
-
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
-
It did, works perfectly. I was missing the Add Array step. Thanks for your help.
Now new issues for a new topic haha