[Solved] My object doesn't show in Inventory when I pick up

Hi I have added in an inventory system in my game and the code (event sheet) looks fine but for some reason it isn’t showing when I pick up an object.

The inventory itself is on a UI layer and NOT on the base layer. It could be a x and y position problem but I’m not sure.


What layer is the key on? If it’s the base layer, then you’ll have to move it to the UI layer.

Also, will the player ever collide with more than 1 key at a time? If not, change this:

to a plain event with the collision and variable checks, and don’t bother with the repeat over each KeyGold object.

1 Like

Thank you it picks up now. But only problems that are left is that:

  1. My position is off when object is picked up
  2. The key doesn’t show in game as I changed it to UI layer and don’t know how to get around it.

I’m kind stuck with these at the moment.

The key is a bit off as you can see when picked up

Here is code if needed

You need to have it on the game layer when playing, and move it to the UI layer when it’s picked up and moved to the inventory slots.

1 Like

Look at the origin of the key, make sure the distance from the origin to the centre of the key is the same as the distance from the origin to the centre of the inventory slot object.

If you need help with that then screen shot the points of the inventory slot object and the keys.

Is it ok if you can show me please in the event sheet. I’m not sure how to do that.

Here are the points.

Inventory:

Key:

The origin of the slot is near the bottom left, while the origin of the key is the top right. If you position each at the same point, they’ll be misaligned because of those mismatching origins.

I’d recommend you move the origin and centres of both the inventory slots and keys to the middle of their images. It’ll mean a slight repositioning of the slots in the UI, but it’ll make life a lot simpler.


There isn’t really much to show. When you create the keys, either placing them in the scene in the editor or via events, make sure you set the layer to Base Layer (or “”).

And when you collect the key and move it to the inventory slot, just add an extra action to change the key’s layer to UI (and change it’s Z-Order to ensure it appears above the inventory slot:

image

1 Like

Thank you so much it’s solved now.