Forum rules - please read before posting.

interact on mouse release & select on drag

edited January 2021 in Technical Q&A

Hi Chris,
I use "Context Sensitive" and want these two types of inventory interaction methods:
1- if player click on an inventory item and Release (the mouse button or finger touch on the item spot) an action list will run (defined as standard interaction use)
2- if player drag an item it uses drag & drop inventory interface.
do you have any suggestions?

Comments

  • It's possible if you rely on a Standard Examine interaction instead of a Standard Use interaction - but you can just assign the same ActionList in the different field.

    In your Settings Manager's Inventory settings, check Drag and drop inventory interface, set a non-zero Minimum drag distance, and then check both Can drop an Item onto itself to Examine it? and Clicking an Item without dragging Examines it?.

    That should allow for single-clicking and item to run its Examine interaction, while dragging to use the drag-and-drop interface.

  • I'll try it and inform you about the result. Thank you Chris.

  • Actually it worked on inventory items but didn't properly on hotspots.

    desirable behavior:

    click = release finger touch or mouse left click

    Hotspot:
    click on hotspots >>> open interaction menu
    click on interaction menu buttons >>> run actionlist defined for related interaction in hotspot use interactions

    Inventory Item:
    click on item >>> open interaction menu
    drag on item >>> drag & drop functionality
    select item if touch>hold>move and drop on release.
    if drop on itself open interaction menu
    click on interaction menu buttons >>> run actionlist defined for related interaction in standard use interactions
    one of menu interaction buttons should select the item.

    What I did:
    I changed interaction method to "Choose Hotspot then interaction", defined a list of interactions in Cursor manager and Menu/Interaction menu, set related interactions in hotspots and inventory items.

    it works fine on hotspots
    only works if **"Mouse clicks have default functionality?" **

    to have drag & drop functionality we checked "Drag and drop Inventory interface?" from Setting/Inventory settings. and assign a non-zero value "to Minimum drag distance"
    but now the problem is we are not able to select item through (inventory:select action)

  • sorry for leaving multiple comments. the other problem is with above settings, when I click on inventory items the interaction menu appears for one frame and goes away. it works with right-click but I just need interact menu only with left-click(release)

  • Your question only dealt with Inventory items. What is the specific issue with Hotspots?

    If you uncheck Mouse clicks have default functionality?, then interaction is then reliant on inputs named "InteractionA" and "InteractionB". Have you defined these?

    but now the problem is we are not able to select item through (inventory:select action)

    When drag-and-drop input is enabled, input must be constant. The item will be de-selected if there's no input in that frame.

    There should be no need to use this Action to select the item, though - a non-zero drag distance means that the item should become selected automatically once they start moving the mouse.

    when I click on inventory items the interaction menu appears for one frame and goes away. it works with right-click but I just need interact menu only with left-click(release)

    I'm afraid you'll need to be more clear. What behaviour do you get with a right-click?

    Please share your full Settings Manager, as well as your AC/Unity versions, Interaction menu's properties, and details of what relevant inputs you've defined in Unity's Input Manager. The more you can elaborate on the specific issues you're facing, the better I can help.

  • edited January 2021

    Sorry
    It should be super easy and I'm sure it is, but seems I've missed something and can't see it.
    this is what I want:

    PC/Mobile:

    • click/touch(release) on hotspots : open interaction menu
    • click/touch(release) on inventory item : open interaction menu
    • drag & drop an inventory item : drag & drop item
      (click/touch & hold > select, move > drag, release > drop)

    Unity version: 2019.4.15f1
    AC version: 1.72.4

    Settings :

    Menu /Interaction :

    Cursor :

    Inventory Item Standard Interactions:

    Hotspot Use interactions:

    Left-Click on hotspot:

    Left-Click on Inv Item:
    (this menu appears and disappears in less than a sec)
    THE PROBLEM: I want this menu stays and behave like hotspots interaction, but it goes and after miliseconds

  • edited January 2021

    Thanks for the details. Though, trying those same settings on my end does appear to give me your desired behaviour.

    That your Interaction Menu turns on-and-off suggests that this may be an issue with the way your menu is set up - though the properties you've shown look fine.

    As Unity UI adds another layer of complexity, we'll first need to learn if this is the cause of the problem.

    What is the effect of switching your Inventory and Interaction menus' Source fields to Adventure Creator?

    If that solves it, what are your Unity UI prefab's Canvas settings? Does the "RectTransform boundary" span the whole transparent box in your screenshot?

    If there's no difference, try creating a new ActionList asset, set it's When running field to Run In Background, and give it a single ActionList: Comment Action with some text to display in the Console. Then, assign it as your Interaction menu's ActionList when turn off property. When the Interaction menu turns on-and-off, check the Console for the message, and copy-paste its full contents (stacktrace included) here in a reply and I'll see what it tells us.

  • What is the effect of switching your Inventory and Interaction menus' Source fields >to Adventure Creator?

    actually it's even worse. I got the same thing (menu flashes and gone) on hotspots too.


    I tried the comment action as you wanted:
    On Hotspot Worked fine

    On Inventory Item appeared for a millisec and faded out itself

    Turn On:

    Turn Off:
    The Unwanted One

  • I think I need to see this for myself. Please prepare a .unitypackage file of your Managers, UI prefabs and related asset files (graphics, ActionList assets), PM it to me and I'll take a look.

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.