Hi,
I have a menu with Apear type set to During Gameplay (OpenInventoryMenu). The menu contains a single button at the bottom of the screen. Clicking on that button opens the actual inventory menu. But now I don't want to open the inventory menu by clicking the "OpenInventoryMenu" menu but with mouse over, and close it when hovering out of the inventory menu.
I dont't want to use the Appear type: mouse over because the area of the inventory menu is too big.
Ultimately the player should go with the mouse to the border of the screen (very thin button maybe?) to open the inventory menu.
Maybe there is a better approach to do this.
Thanks for any answer!
Raul
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
If a Menu is locked, it will remain turned off even if its "Appear type" condition is met. You can keep the Inventory menu set to appear during gameplay, locked by default (the Start game locked off? property), and then unlock it when they mouse over OpenInventoryMenu.
You can have a custom script hook into the OnMouseOverMenu custom event to detect when the player has begun hovering over a particular menu, but you also need to detect when the player has left the Inventory menu in order to close it. Something like this should do it:
Yeah that work pretty good! thx
But
the inventory menu does not close when leaving the menu
I've updated the above - give it another try.
Hi Chris, I have 2 Inventory boxe elements(1 for each category) in my inventory menu and I am trying to hide/unhide these elements depending on which scene the player is in. When using this script you provided above, whenever there's an Inventory element(InventoryBox) hidden from the beginning, it gives me this error. How can I fix this? Thanks in advance.
"Couldn't find menu with the name 'Inventory'
-> AC debug logger
UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
AC.ACDebug:LogWarning (object,UnityEngine.Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:39)
AC.PlayerMenus:GetMenuWithName (string) (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:2822)
CustomInventoryMenu:Update () (at Assets/PointClick/Scripts/OpenInventoryMenu.cs:28)"
Sorry, to be clear: does this mean it works when your element is visible by default?
Is your Inventory menu named "Inventory", and what's your AC version?
The message you've pasted should only be a Warning - are you getting an Error message as well? Try replacing:
with:
The game runs, but the Inventory menu doesn't work. The item graphic in the Inventory menu doesn't show up even though I can see the lable when hovering over the item.
Yes is named "Inventory". The AC version is v1.81.7
Not getting an error, the message keeps coming up on the console, and can't move the character nor bringing up the menu...etc. Replaced this code, still the same.
Does having 2 Inventory boxes and switching them back and forth in 1 menu create any conflict?
I am using the show/hide menu element action, and from what I am seeing, only the Inventory Box element that's in the front is displaying properly, the one behind either shows up without graphics "when slot is empty: clear content", or nothing showing at all "when slot is empty: Disable Object", even though the Inventory Box element in front is hidden.
So the Inventory element is invisible, but the Hotspot menu is behaving as though it is?
The warning relates to the naming convention of your menu - is your Menu named "Inventory"? If not, adjust the code so that it references the different name.
If your Menu uses Unity UI, there could be a conflict if the "hidden" top Inventory is still clickable, which'll be the case with the "Clear Content" setting.
Can you elaborate on the underlying situation, and the need to rely on 2 separate InventoryBox elements? If it's to e.g. display items in different categories, it may be easier to use custom code to change categories shown in a single element.
I wanted to have a set of inventory for the real world, and another for the dream world. After changing the Inventory menu to using AC from unity UI, everything seems to work perfectly now.
This warning is most likely caused by the scene itself because I tried it in another scene and it seemed to work. I should have tried it first but thought it was only menu related.
Everything seems to work out now, thank you so much for your time Chris. You are the best.