playMaker

Author Topic: Mouse UP/DOWN Global Events for Right Click (System Events)  (Read 2175 times)

Farwest

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Summary:
A picture is worth a thousand words:


Details:
Instead of using "Get Mouse Button Up/Down" actions, I need to use Global Events (Global Transition>System Events) for Mouse Up/Down for Right Click over States and it seems that MOUSE DOWN and MOUSE UP global events are working for left click only and I don't want to mess with Unity's Inputs.

Is it possible to have seperate Global Events for Mouse Down and Mouse Up for Right Click only?

Reason:
I don't want to use Mouse Over>Get Mouse Button Up/Down which Mouse Over seems to me a clumsy approach for Mouse Down events (Mouse Down shoots the event once, but if I do same thing with Mouse Over, it resets the State Event chain before it finishes especially if FSM transitions take more than a frame, thus Mouse Over is not useful and having Mouse Down working for Left click is limiting us in design)

Thanks
« Last Edit: July 10, 2019, 04:04:41 PM by Farwest »

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Mouse UP/DOWN Global Events for Right Click (System Events)
« Reply #1 on: July 03, 2019, 07:28:21 PM »
You can make a new FSM that handles the input (generally a good idea), where you listen for the right mouse button and then send a global event. Then you can start your current FSM with that global event.

(your picture doesn't show up)

Farwest

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Re: Mouse UP/DOWN Global Events for Right Click (System Events)
« Reply #2 on: July 04, 2019, 09:54:48 AM »
But there will be multiple objects that would listen same Global Event. Thus I fear it may confuse all objects with same Right Click with that approach.

In my approach, only a specific gameobject will open Tooltip UI when clicked on that gameobject only. MouseDOWN/UP Events work, but I need their Right Click versions. (MouseOver works too, but there are occasions where I don't prefer using MouseOver often, there is danger it resets the State Machine to beginning MouseOver state before State transitions finish)

Thanks, I fixed the image too, it seems I couldn't make "Insert Image" work so I used Hyperlink function now.

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Mouse UP/DOWN Global Events for Right Click (System Events)
« Reply #3 on: July 04, 2019, 10:47:23 AM »
Okay, that seems by design from Unity, see here.

You can use the Input Manager, too, and in PM the get button down actions in a one state that listens for both inputs (each wired with a different event to your two existing states).

Farwest

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Re: Mouse UP/DOWN Global Events for Right Click (System Events)
« Reply #4 on: July 04, 2019, 12:37:57 PM »
Yes it is unfortunate to see.

I did that way, it didn't work efficiently in same FSM with other inputs, but it worked good under different FSM which is dedicated for listening Right Click only (MouseOver>get mouse button down-Right to open the UI, same state get mouse button up-Right to close the UI). Thanks for your suggestions.

The Feature request I did for Having Mouse Up/Down Global Events with Right Click still exist, which I hope it will be very handy than need to create action chains or seperate FSMs to work with.
« Last Edit: July 10, 2019, 04:10:10 PM by Farwest »