Boolean not detected in inventory UI system

Hi! Sorry for frequent questions, but I’m trying to make an inventory where each SlotIcon has an object variable called occupied, which should turn from false to true when I place an item in that slot.
I already have this working but the thing is it doesnt work with items that have been
added to the game at the beginning of playtesting/ the scene.

But the event that checks SlotIcon.occupied = 0 doesn’t work. The item doesn’t get stored and the condition never triggers.

Here’s what’s happening:

  • Each SlotIcon object has a variable occupied (default = 0).
  • When picking up an item, I loop through each SlotIcon.
  • I check:
    If SlotIcon.occupied = 0 → fill the slot → set occupied = 1.
    But that just does not work.

Can someone help me with this please and tell me the solution?

Thanks in advance! yippee

It’s the Trigger once condition on the Repeat for each SlotIcon event that’s causing the issue. Once a sloticon satisfies the conditions, subsequent sloticon objects are ignored.

Here’s a thread on why. Post here if you need help sorting it out.

1 Like

Hi again! Sorry for confusion but instead i meant if there’s already an item in, let’s say the 1st row, it still adds to the row thats occupied, so occupied doesn’t work, but that might be what i already explained (-_-III)

1 Like