Forum rules - please read before posting.

Speech skipping selects Inventory Item

Hi Chris!

Whenever I skip a speech line and the mouse hovers over an inventory item, it selects the inventory item. I believe it is because the speech line get skipped OnMouseDown but the inventory item is attached OnMouseUp (OnClick).

Is this a bug or am I missing something?

Thank you! :)
Alex

Comments

  • I'll attempt a recreation. Can you share screenshots of your Settings and Speech Managers, as well as your AC and Unity version numbers?

  • edited August 2022

    I tried to recreate it with the default inventory and there I don't have that bug.
    It seems the default inventory uses OnMouseDown for selecting an item.

    I have a custom inventory and I get clicks with:
    EventManager.OnMenuElementClick += ElementClick;

    I think thats the problem and there is not delegate for a OnMouseDown in EventManager. Or is there?

  • OnMenuElementClick includes a button parameter for the type of mouse press involved.

    I will still require the details above, and please share the custom code you're using as well.

  • edited August 2022

    Unity 2020.3.33f1
    Adventure Creator v.1.75.4
    https://www.dropbox.com/sh/qhenua8kg6tfhu9/AADxp5nnlvze9rrrK6ESrp-Ta?dl=0

    I hope this helps.

    Yes, I know that there is a buttonPressed parameter involved but this is only if left or right button. The Event itself is insufficient. There should be another event which fires OnMouseDown so I can rebuild the same functionality like in the stock Inventory and avoid the bug.
    Something like: EventManager.OnMenuElementMouseDown

    Another thing to mention is that while the speech is playing it is in cutscene. So inventory interaction should be (and from the settings is) disabled.

    Thank you!

  • I cannot recreate the behaviour.

    It should be - based on your settigns - that the event is fired only upon clicking down. Is it firing when clicking up only while speech plays, or in regular gameplay as well?

    Though, it is possible to get the current click state with:

    KickStarter.playerInput.GetMouseState ()
    

    Use a Debug.Log statement to print this value inside the event - what does it show, stacktrace included?

    Are any other custom scripts involved?

  • edited August 2022

    Regular gameplay as well.

    UnityEngine.Debug:Log (object)
    Prim.PrimInventory:ElementClick (AC.Menu,AC.MenuElement,int,int) (at Assets/PRIM/Scripts/Logic/PrimInventory.cs:70)
    AC.EventManager:Call_OnMenuElementClick (AC.Menu,AC.MenuElement,int,int) (at Assets/AdventureCreator/Scripts/Managers/EventManager.cs:705)
    AC.MenuInventoryBox:ProcessClick (AC.Menu,int,AC.MouseState) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuInventoryBox.cs:2380)
    AC.MenuElement:ProcessClickUI (AC.Menu,int,AC.MouseState) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuElement.cs:265)
    AC.MenuInventoryBox:ProcessClickUI (AC.Menu,int,AC.MouseState) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuInventoryBox.cs:331)
    AC.MenuElement/<>c__DisplayClass38_0:<CreateUIEvent>b__0 () (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuElement.cs:215)
    UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent ()
    AC.OptionalMouseInputModule:Process () (at Assets/AdventureCreator/Scripts/Menu/OptionalMouseInputModule.cs:193)
    UnityEngine.EventSystems.EventSystem:Update () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:385)
    

    Stacktrace from regular gameplay.

  • Thank you - recreated with this. I will look into a workaround / fix.

  • If you're using Unity UI, then yes - clicks are registered on the "up".

    I think the best approach would be to have the same behaviour when skipping speech. To do this, you can use a custom delegate for AC's InputGetButtonDown function. Uncheck Skip speech with mouse clicks? and use this:

    private void Start ()
    {
        KickStarter.playerInput.InputGetButtonDownDelegate = MyGetButtonDownDelegate;
    }
    
    private bool MyGetButtonDownDelegate (string inputName)
    {
        if (inputName == "SkipSpeech")
        {
          return Input.GetMouseButtonUp (0);
        }
        return Input.GetButtonDown (inputName);
    }
    
  • Hi Chris! I fixed it like you suggested and it works for now but I really would like to be able to attach inventory items / skip speech OnMouseDown.

    Is this something you consider for an engine update?

  • Unity UI components respond to click "ups" by default, but the AC Responds to property in UI-linked elements can be set to Pointer Down.

    The exception for this is with InventoryBox elements when the Settings Manager's Inventory interactions field is set to Single - in which case a pointer-down response is achieved by enabling the drag-and-drop inventory option in the Settings Manager.

    I will see if it is possible to lift this restriction, however.

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.