I don’t think an editor script is a good way to go about accomplishing this goal. I don’t even 100% know that it’s possible to write an editor script that will respond to every input event the mouse sends from anywhere in the Editor.
I would say you should use whatever software your mouse came with to map those buttons to the menu items themselves (or the appropriate key combos).
I should precise that I can’t even see the Debug.Log in the console, which indicates that I can’t even get the event to recognize I’m clicking the mouse buttons while working on my scene. Is the method “OnGUI()” even the correct “space” where I should put it?
This script is placed in an Editor folder but is not attached as a component to any gameobject.
@Kurt-Dekker
I’m not sure to see what applies to my case in the sample code of the page you linked…
Also I’m not trying to override any notion of Undo/Redo. I just want to have the same effect as when I click Ctrl + Z / Ctrl + Y (or Edit > Undo / Edit > Redo) but with my mouse.
@StarManta
I have a logitech mouse M500 and the program that controls its functionalities is Logitech SetPoint. But I don’t see anywhere allowing me to map these keys specifically for Unity. It works by default as Next / Previous on the internet, so I’m reluctant to change that for the whole mouse. I need it only for Unity.
Update:
So I found the solution to my problem.
Contrary to what I stated previously, it turns out I was able to map the Ctrl + Z and Ctrl + Y with Logitech Setpoint exclusively for Unity. Worked perfectly. No code needed indeed!
Thanks to all !!