Forum rules - please read before posting.

Bring Hotspot label infront of selected item graphic?

edited March 2022 in Technical Q&A

So I'm having this issue where my Hotspot label menu is behind the item when you select an item. Menu is set to appear type: On Hotspot and position is on follow cursor.

Demonstration: this is what its like when you dont have the item selected and you hover over it, which is good so far

But when you select it and go over another item, the item's graphic is layered on top of it.

Same thing happens when you have the item selected and hover over hotspot

What are the workaround for this? I don't see a layer system and my hotspot menu is the most bottom one in the menu tab.
I am using custom inventory script so I'm guessing the best way is probably through custom events but I have no idea which one to call and what lines of code I need.

I think OnHotspotSelect event is needed? and for the item hover OnMenuTurnOn? but have no idea on what to put. One way I'm thinking is maybe I need to tweak the y position by code so it atleasts is over the item for example so then it wouldn't matter if the UI is behind it but it needs to act differently whether its an item hover or hotspot hover.

Any ideas/solution would be much appreciated.

Comments

  • Is this a case of the selected item being the cursor graphic?

    How this is rendered relative to other elements will depend on your Cursor Manager's Cursor rendering setting.

    If set to Software or Hardware, then it'll always be drawn last in the frame's draw call - the former relying on Unity's ImGUI mode, the latter relying on the system cursor, which is always drawn atop everything else.

    If you want to have it be drawn underneath certain elements, you'll need to rely on the Unity UI option, which delegates a Unity UI canvas prefab for the drawing of the cursor - selected item included.

    Your Menus will also have to be rendered with Unity UI, but you'll then be able to control the relative drawing order via the Z position in their respective Canvas prefabs.

  • edited March 2022

    @ChrisIceBox Yes when you select an item, the cursor changes to that item's graphic.

    It is set to Software and I have Replace Mouse Cursor? box checked with my own custom cursor graphic (Not sure if that is relevant).

    My inventory menu uses Unity UI Prefab, but the Hotspot menu is still set to Adventure Creator since all I needed was the label and not much customization was needed for it anyways.

    If I change my Hotspot menu to using Unity UI prefab, will it fix the problem if I simply change the Z position?

    Also can it be Unity prefab OR Unity in Scene or only one of those?

  • Software rendering using Unity's ImGUI system, which is drawn last in the frame's draw calls. To be able to control the relative ordering of cursor/menus, all must rely on Unity UI. Menus can be prefab or scene.

    Changing the Z position of the Hotspot UI prefab should do it, provided that you also use Unity UI for the cursor.

  • is there a tutorial for using unity UI for the Cursor?

    I came across this: https://adventure-creator.fandom.com/wiki/Unity_UI-based_cursor

    says "This feature is now included in the official AC release." and I think the wiki itself is outdated when you follow the steps.

  • edited March 2022

    The wiki script was moved into the official release with AC v1.74.1.

    The Manual's "Unity UI cursor rendering" chapter covers its usage.

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.