Hi, I have a rectangular style Inventory Menu with the Appear Type set to Manual. I’ve set up my Inventory and Inventory Cursor settings as shown in this link (https://imgur.com/a/hxbYwZg). I’m trying to figure out how to hide the Inventory Item Icon next to the cursor sometimes, even when the When inventory selected option is set to Change Cursor.
In my menu, there’s a "Use" button. When I click it, the inventory window closes.
My question is:
Even though I’ve enabled the Change cursor when over? option for the "Use button", the inventory item icon still appears next to the cursor (as shown here https://imgur.com/xQg878B). I need the When inventory selected: Change Cursor feature, but I want to temporarily disable it when my mouse is over the "Use button" in the inventory window.
How can I achieve this? Thank you so much in advance.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Through scripting, you can read the value of MouseOverMenuElement and compare it with your Button, and alter the When Inventory selected field accordingly.
Try this, replacing the "Inventory" and "ExitButton" strings with the name of your Inventory menu, and Exit button, respectively:
Hi, thank you for your quick response!
I tried the script, but I got the error: "CS1501: No overload for method 'GetMenuWithElement' takes 2 arguments" in the console. So, I tried this but
now the problem is that once the inventory window closes, the inventory icon next to the cursor doesn't reappear, even though an item is still selected. The "Use button"'s Click Type is currently set to Turn Off menu, and "Left-click deselects active item?" is unchecked.
Could you guide me on how to fix this?
I can't recreate such behaviour.
Hi Chris, Thanks again for your help. And sorry for not sharing some basic information earlier.
Adventure Creator: v1.81.6
Unity: 2022.3.31f
Menu Source: Unity UI Prefab
No, it stays as "Do Nothing." (https://drive.google.com/file/d/1IFozTSA4K_OY23F8qjVX7QHJZ8XfJuX3/view?usp=sharing)
Yes, the interaction works when I click a Hotspot.
By the way, I followed this post (https://adventurecreator.org/forum/discussion/14782/show-use-icon-and-the-item-icon-in-the-cursor-at-the-same-time-if-hovering-over-a-hotspot) to display an extra icon when hovering over a Hotspot with an inventory item selected. In the video, the green circle behind my main cursor (the cat's paw) is the extra icon.
I also tried creating a fresh project, but the issue persists.
Does the issue remain if you (temporarily) switch back to AC as the Menu's Source?
Try replacing:
with:
Thank you so much for your help! Everything is working perfectly now. The issue was that I had attached the script to the Canvas UI Prefab as a component. I tried the new script with Adventure Creator, and it worked because I attached the script to an empty GameObject in the Hierarchy instead.
I do have a follow-up question, though: what would be the best way to trigger this script in each scene without having to create an empty GameObject with the script for every scene? Should I use the Event Editor's Scene: Begin Game and then use the Object: Call event action to trigger the script? Since this is a new topic, I'll create a separate post for it. Thanks again for all your help!