Force left mouse up in editor

I have a custom editor script in which I have a slider. When I move the slider I want a function to cancel it when I press the right button.
How can I send an event that tells the editor left mouse button is no longer being pressed and won’t register that it is until it’s released and pressed again?

I dont think this is possible. After all, the left mouse button is pressed in your situation. So your implementation should account for that by, for example, ignoring the click after your condition is met, and require a KeyDown for the left mouse button to be counted again.

I’m not sure you’re right. There is supposedly a way to fake inputs with ExecuteEvents, but I have no clue how to use it.

Also, a slider is a GUI function so nothing in my code (I believe) will decide what happens once you click the handle. Once you click it will slide until you release it unless you stop the function it’s called from, but that would break stuffs.

To make the mouse lose the slider you can try deactivating the input event. This seems to discuss something similar:

I tried that idea but it seems to disable too much and gives an error.

NullReferenceException: Object reference not set to an instance of an object