Forum rules - please read before posting.

Unity UI - Inventory - Lost right click examination functionality

edited April 2021 in Technical Q&A

Hello,

I've just noticed that since switching my inventory to Unity UI I've lost right click examine functionality. I can't see any AC inventory / menu settings that have changed - I've just hooked up the menu to use a UI prefab.

Previously this would happen when I right clicked on something...

...and the examine action list would instantiate in the hierarchy at the same time.

Now however right clicking doesn't register, and examine action lists aren't being instantiated.

Here are my settings:

I can't remember how right click interactions are setup in AC. Where should I start debugging this?

Comments

  • It should be automatic.

    In the background, AC should add a "UI Slot Right Click" component to your inventory slot Buttons to the runtime Canvas, which listens for right-click / InteractionB inputs made over the Button.

    Are these present on your menu at runtime? If so, try placing Debug.Log statements inside the component's script to check if anything's being run.

    If not, what are your AC/Unity versions, and Interaction method?

  • edited April 2021

    Ok the good news is that everything you said is happening. It appears to be a problem that the right click only registers in a small zone of the graphic, and not matching the actual size of the sprite as seen.

    In the above, as soon as the text label appears I'm right clicking but you can see the examine text only pops up when clicking on the centre of the graphic. I'm also having problems when adjusting the size of the game tab- so I'm not convinced my UI is setup / scaling correctly.

    Here's the prefab:

    Is there anything there that looks wrong to your more experienced eyes Chris?

  • Is there anything there that looks wrong to your more experienced eyes Chris?

    I don't think I'll ever fully understand Unity UI..

    But if your Button and Image components are on the same object, it may be a case of something else blocking clicks to it. Are any other UI elements overlapping it (perhaps even from another menu)?

    If your Hotspot menu is also Unity UI-based, double-check that it's not interactive. Attaching a Canvas Group to its route and unchecking "Interactable" is a quick way to do this.

    It'd also be worth keeping your EventSystem object selected in the Hierarchy. At runtime, it's Inspector will list the element it's currently detecting - it should help determine if it's picking up something else by mistake.

  • I don't think I'll ever fully understand Unity UI.

    I get you. I still have nightmares of all the groups and such needed to get a conversation option UI working correctly.

  • @ChrisIceBox You were spot on about the overlapping menu. The item name menu / UI was causing the problem. Setting "interactable" and "blocks raycast" to false on its root canvas group solved the problem.

    Appreciate your time as always.

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.