Forum rules - please read before posting.

Inventory shift buttons work by clicking them or selecting them with a controller, but not both.

Hi. I just implemented the Inventory shift buttons. But I ran into a problem. I'm using Unity UI. If I'm using mouse and keyboard, the buttons can be clicked when the menu element's 'Responds to' is set to 'Pointer Down', but if I'm using a controller, selecting the button and pressing A doesn't do anything. If I set it to 'Pointer Click', it works with the controller, but not when clicking on it with the mouse.

I've tried using (AC.PlayerMenus.GetElementWithName("Inventory", "ShiftLeft") as AC.MenuButton).uiPointerState = AC.UIPointerState.PointerClick; to change it dynamically, but it doesn't seem to work.

How can I fix this? Alternatively, I could add something to each buttons OnClick() in the prefab, but what would be the correct code to do that?

I'm using Unity 2022.3.26f1 and AC v1.74.2.

Comments

  • Pointer Click should work for both - and I can't recreate such an issue in the current release.

    If you needed to go down the OnClick route, you can run this code to simulate the clicking of a given element as though it was being clicked through AC:

    AC.Menu menu = PlayerMenus.GetMenuWithName ("Inventory");
    menu.GetElementWithName ("ShiftLeft").ProcessClick (menu, 0, AC.MouseState.SingleClick);
    
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.