Forum rules - please read before posting.

Show/hide inventory with button press

Hello, I am trying to setup an Inventory that is shown if the user presses an Inventory button (always visible on the screen). 
I am building a game for mobiles, so I am using Touch Screen as Input method. 
The scene starts with the Inventory button locked, since I need the user to learn how to play the game and enabling things one at a time.
I am enabling the Inventory button after the user picks up a backpack that's in the scene. 
I am using "Unlock Menu" to show the Inventory Button. 
It is just a Canvas with a Panel and a button:
image

The button prefab is like this:
image

After unlocking the Inventory button the player doesn't move anymore, but the current game state is normal. 
What's wrong? 

Then I will use the OpenCloseInventory ActionList to open/close the standard Inventory:
image
This is ugly but it works: I need the button to be over the inventory to be able to press it again to close it.
Is this the best way to do it?
Thank you

Comments

  • You don't need to determine the Inventory's state with a variable: just use the Menu: Check state Action to see if it's locked or not.

    As for the stuck player issue, have you checked to see if the Inventory canvas itself is blocking taps/clicks?  Be sure to only make the RectTransform cover as much screen space as you need it to.
  • Thank you for the check state suggestion.
    I got the player moving again now, but I don't know why. BTW, this is how the InventoryButton looks like now:

    image

    And this is the "OpenCloseInventory" ActionList to Hide/Show the inventory after button click:
    image

    Thank you for your time!
  • Looking better - if your InventoryButton's Appear type is set to "During Gameplay", then you also don't need to turn it on explicitly - simply unlocking it will be enough.
  • Thank you, it works.
    I still have a small issue: 
    I am enabling the InventoryButton after the player collects a backpack. 
    I am using this cutscene:

    image

    The InventoryButton is enabled only after the dialogue is over or skipped.
    If I set the dialogue to Play in background, the button is enabled before the dialogue.
    It is not a big problem, but maybe there's something I am missing.

    P.S. translation of the dialogue for non italians:
    "The top left button is the Inventory Button. Press it to display the content of your backpack!"
  • If you've set your InventoryButton's "Appear type" setting to "During Gameplay", then it won't appear during Cutscenes.

    For complete control over when it's displayed, set the "Appear type" to "Manual" instead - you can then use the Menu: Change state Action to turn it on and off at will.  You won't need to lock / unlock it, that way.
  • Thank you! Hope I won't bother you anymore with menus :)
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.