Control over the order of GUI observables

Hello, I’ve two inputBoxes on the scene and I’ve onPointerDown and onBlur observables on them.
In the scenario where one inputBox is in focus and user clicks on the other inputBox, two observables are fired. First’s onBlur and second’s onPointerDown.

The problem is that onPointerDown observable fires first and then the onBlur observable. I want the onBlur to be called before onPointerDown observable. Is there any way to achieve this?

That’s actually the right order of execution. If you always expect a blur to be called, you can debounce the pointerDown call (using external libs, babylon doesn’t support it AFAIK) and call it a few ms after.

The better variant would be to subscribe to the blur observable in the pointerDown observable, wait for the call, execute it, and only then execute the pointerDown logic you want. The unsubscribe from the onBlur.

But, as always, there are 200 different ways to achieve that