Forum rules - please read before posting.

How to get rid of empty inventory slot

Hi i was wondering how would i get rid of empty inventory slot. I did use the Menu: Check num slot and that works on one slot but i'm trying to do when inventory is removed then check for inventory slot 1 or 2 or 3 or 4 then remove the slot. For example: I have 4 inventory items then when i find 1 inventory it removes the name on inventory and then the words slide to next slot then removes that empty slot but i can't seem to check for 3,2, or 1. This is the image of removing 1 empty slot and it does work but how can i check for if there is 3,2,1 slots left to remove them http://imgur.com/q9UZFE5
«1

Comments

  • edited June 2015
    This is because you only check for 4 items value in your Menu check num slots and after the removal of one it stops and do nothing when you use your actionlist again.

    You need to pass on further if the value is less than 4 and continue to your removal process.
    I would have used, if it is more than 0 in Menu check num slots then go to Inventory: Check.

    This way you don't need to worry about how many slots are out there in your game.
    For example, you could increas the difficulty of the game by increasing the number of objects a player must find for example.
  • edited June 2015
    To SkyTree that still won't work considering i want to destroy the inventory button every time a inventory object is found. If i put another add or remove action at the end of the other to destroy button 3 it will just destroy the two of them though. more than 0 is a good call but how would i destroy the third button though through to 1 button. I only showed the 4th one being destroyed there but i was trying to do the other buttons as well. http://imgur.com/LuPXYGH Iput this image to show you what i mean. The three object: Add or remove that are not linked is what i want to destroy as well so because my inventory works backwards and i only have 4 items in this one to find so when i find 1 item the 4th button gets removed then i have three left so then i want it so if i find another item the 3rd buttons get destroyed and so forth.
  • edited June 2015
    I don't understand, if you have all your inventory buttons with constant ID why not just simply pass it directly for each inventory button?
    Plus why do you need Check Num Slot at all if the conditions is not met you have no other action to send to. Just start with action 2 and so on.image

    Or try to use run in parallel action after action 2 : Inventory Check if conditions are not meant and send it to remove action and the other send to 4 : Inventory Check action.
  • edited June 2015
    Sorry. Correction to my image
     2: Inventory : check if conditions are met should go to 4 : inventory Check and so on just like in your picture. But in my I erased those lines , and those green lines should be there :)

    Sorry for my nonsense... if it won't work
  • I'm not sure how clear i can be so i'm saying this how do i remove a inventory button when i have found an object. I have only 4 objects and when i find an inventory it is removed and then the words slide to the next available empty slot. I need it when the object is found it still slides to the next available slots but i need it to remove the empty inventory slot after an inventory is found. Oh and yeah i couldn't view your inventory so i am not exactly sure what you meant and i know that the other three object: add or remove is not linked because i was trying to show you what i meant.
  • Oh and also i do not know what you mean about past directly for each inventory button. And i forgot to mention that i also have 4 buttons to be removed in the inventory
  • I should also mention my inventory looks like this http://imgur.com/e99bzlO and the words slide up to an empty inventory slot
  • So long as you have Can re-order menus? unchecked, then inventory items should remove empty slots automatically, so long as you're using v1.46.  Is that not the case?  But if you want the empty slot to come back once it's filled, you shouldn't use the Object: Add or remove Action - because you'll delete it forever.
  • Yeah its unchecked and i am using v1.46 but the squares just stay behind. And no i don't want them to come back. This image is after i find one object and the inventory word is removed but the inventory button stays behind though http://imgur.com/K2g1BrX
  • edited June 2015
    To make any part of your Unity UI invisible, you can register it in the Menu Manager as an element (e.g. an empty Graphic / Label), and then using the Menu: Change state Action to hide it.

    How have you set up your Inventory UI's hierarchy?  Please post a screenshot of your UI's hierarchy (expanded), and let me know which Buttons you've assigned to the InventoryBox element in your Menu Manager.
  • Oh i thought you only have and inventorybox element because i only used the example and just changed it except for the menu element. Here is a screenshot of my hierarchy and the inventory menu, i also didn't use a grid because my inventory isn't straight and added the txt to the buttons otherwise the text for the inventory wouldn't work considering i didn't want the icon. http://imgur.com/Ve9oMAi So are you saying i can use labels and graphics instead of the buttons.
  • I am still in need for this solution still can't work it out.
  • What is the state of the "empty" slot in-game?  AC should de-activate the Button gameobject (e.g. btnSlot4), which should in turn also hide the text child.  Is this happening?
  • The inventory text gets removed which is good but the buttons just stay there, they don't disappear. Maybe its because i have a completely different inventory.
  • Sorry i don't know if this has anything to do with it but in the inventory menu in the Game editor i have text only and have certain categories.
  • It may do.  But what I'm asking is if the UI slot gameobjects actually get disabled (i.e. greyed out within the Inspector).  Have a look in the hierarchy view when this happens - you'll need to expand the UI fully to see.
  • No the buttons don't get greyed out. I also click on an object to open the inventory if that helps.
  • Something's not working, most probably.  They should be getting greyed out once they leave the inventory.  I'm assuming you're doing it the normal way - using the Inventory: Add or remove Action?

    You might have to PM me you canvas prefab so that I can take a look.  Bundle in your Menu Manager asset file, too - you can select the two assets and right-click to export a .unitypackage file - no other files should be needed.
  • Hi just sent the files so hopefully i did it right. So i have probably done something wrong. I always thought that the buttons just stay there that's weird. What i just sent you was just 1 of my inventory's the other inventory's are all the same. I'm going to just do a basic inventory on my behalf to see if i still get the same problem. Thanks for all your help.
  • I used the original Ui inventory with icons only and the buttons don't come up so i tried the text only way and the button still don't remove so maybe it wasn't what i was doing wrong then.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.