Forum rules - please read before posting.

Ignore mouse drag?

Hi - another strange questions maybe but I made sure nobody else had asked anything similar :)


My inventory is a Unity UI menu where you can drag and drop the buttons to move them and reposition them. 

 It works great but the only problem is that AC registers the click down like a standard mouse click. So I can click on the button, drag it, but when I release the mouse button, AC triggers the action list. I'm using Single interactions in the Inventory settings.

I don't want to use the Drag and drop inventory interface from the settings because I want the player to be able to reposition the buttons anywhere on a canvas.

Is there a way I could tell AC to ignore mouse drags? Sorry again for the custom code question but I have no idea if it's a problem from the AC end or my Unity code. 

Comments

  • If you're running custom code atop AC, I wouldn't say it's so much as a bug with either - just that one needs to account for the other.

    First of all, know that AC already has a "swap items around" feature - labelled Items can be re-ordered in Menu? in the Settings Manager.

    It works great but the only problem is that AC registers the click down like a standard mouse click

    Do you mean the "click up", or does your script involve two separate clicks?

    For total control over your InventoryBox's click behaviour, you can set it's Inventory box type field to Custom Script.  It will still display your full inventory, but clicking on it won't do anything by itself and you can instead rely on a custom OnMenuElementClick event to process it yourself.

    A tutorial on custom events can be found here.  An example on the above event can be found in the Manual's "Custom interaction systems" chapter.

    To run the default behaviour of an inventory box through code, call the ProcessInventoryBoxClick method:

    KickStarter.runtimeInventory.ProcessInventoryBoxClick (myMenu, myInventoryBox, slotNumber, 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.