#inventory system error

1 messages · Page 1 of 1 (latest)

placid hemlock
#

i am creating an inventory with a tutorial from sykoo (https://www.youtube.com/watch?v=IhmqxXaK9hY&list=RDCMUCNJvwJ6daLmw4_gUKTw4cSg&start_radio=1&rv=IhmqxXaK9hY&t=992)
but i keep having bug about "child out of bounds" , can some1 show me how to fix it ?

In this episode, we're creating and adding items and weapons to our Inventory system in Unity 2019! If you enjoy, make sure to leave a comment suggesting new features, and I'll make more! =)

♥ Support Sykoo on Patreon: https://patreon.com/SykooSam

····················································································

► Join us...

▶ Play video
quiet ingot
#

It seems to me that Inventory's slotHolder GameObject doesn't contain any children in it. So when you try to GetChild(i), Inventory.cs 23 line, you get error.

#

Maybe in your Inventory component field slotHolder referencing to invalid gameObject. Field slotHolder in the inspector should probably referencing to slot_holder GameObject.

placid hemlock
#

i checked again and i copied everything on the video , and i fill all the component field but it still not fixed

#

can you explain more why it doesnt work ?

tardy pike
#

Do you have 30 slots

quiet ingot
#

Hmm, then maybe problem is in slots. Make sure slot_holder contains exactly 30 slots.

placid hemlock
#

i only have 25 slot

tardy pike
placid hemlock
#

mb

#

thank you for helping

tardy pike
#

What's the point of hardcoding Slot count though
Just do transform.childCount?

placid hemlock
#

sr im new to programming wah