How can I change the SortOrder of my UIGridLayout to sort first Equipped pets and after non equipped pets

Here, here is Padrox.

I’m making an inventory and I would like to sort my pets from the equipped and after the non equipped pets.

I’m using a UIGridLayout.

How can I do this?

2 Likes

Firstly you would need to find out which tool is equipped then do your function which would put a frame into your custom inventory and then do the non-equipped tools.

Padrox, in your UIGridLayout, set the sorting by “LayoutOrder” and then, put the layout order property of your templates at first.

So, if the LayoutOrder property of your template is 1, it comes first, if it’s 2, it comes second etc.

So when I equip a pet i change the pets template’s Layout Order to 2 and When I unequip it change the Layout Order to 1?

No, put every non-equipped template to like “8” and then, whenever the player equips a pet, set the layout order to the number of already equipped pets + 1

1 Like

So, if the player has 0 pets equipped, LayoutOrder would be 1, 1 pet equipped would be 2 and etc. Also, don’t forget to set the template layout order to 8 when unequipped.

3 Likes

Ok thx you very much !

I’ll give you my feedback :stuck_out_tongue:!

1 Like

K, if it works, put it as the solution so we know it’s solved ^^

1 Like

I already put your comment as the solution xD

So it is working perfectly!

Thank you for your help !