How can I detect in an editor script when the current scene tool is changed?

I am designing some custom editor tools that are similar to the terrain tools in that they act like extended built-in tools where only one can be selected at a time.

I already have it working to the point where selecting one of these custom tools deselects the built-in tool using Tools.current = Tool.None, but I can’t find a way to reliably determine when one of the built-in tools (translate, scale rotate, etc.) has been activated, in order to deselect the currently active custom tool.

Is there some sort of event I can register a callback with, or a message I can listen for? It has to be possible somehow since the terrain editor tools do it.

Tools.viewTool

returns the currently selected tool :slight_smile: