Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

515
Vistas
Can i make the children of my grid layout group not follow the hierarchy? (Unity)

Probably a stupid question but anyway: I have a grid layout for my inventory (Unity 2D 2020) and I would like it so when I pick up an item the inventory displays the items in the order that the gameobject is activated. Currently, if I have an inventory with the hierarchy order as apples, oranges and lemons it looks like this:

apples | oranges | lemons

And if I have no more oranges it looks like this:

apples | lemons

But if pick up an orange at a later time it pushes lemons to third and oranges goes back to being second place instead of being third.

Is there any way to make the grid layout follow the order the items are activated?

I hope this is clear - I suck at explaining things, I'm sorry.

Thank you!

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

From what I understood, you want to create inventory by sorting what items you get first.

In UI setup, you can have Parent GameObject, let's call it "Panel", with Grid Layout Groupcomponent and make prefab of that. Also make another Child GameObject of Parent and call it "Container" and make prefab of that too. Lastly you should have prefabs for Apple, Orange and Lemons.

The Panel will always be there in hierarchy but you will Instantiate each container when you have new item, for example if you get Apple, you will instantiate apple container inside Panel. Check if you have already instantiated apple container, if not then just add apple gameobject. Do this for other items as well. The instantiated container will always be next in UI.

Sharing some UI setup image I did. (This is only to make you understand)

UI Setup, showing Panel and Container

UI Setup, showing Panel and Container

Panel Component configuration

Panel Component configuration

Container component configuration

Container component configuration

Output window

Output window

Let me know if you need more assistance.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda