Is it possible to raycast during edit mode?

So I have this custom made navmesh editor for 2D pathfinding used by enemies in the game. I can add nodes, connect them, disconnect them, move them around, whatever, and then assign them to an enemy for ingame use.

What I’m trying to do is make an option to automatically fill a space with nodes and connect them in a grid-like manner, BUT not connect them when a platform is in the way.
For this purpose, each potential connection between two nodes is checked via raycast on my “World” layer which contains all the platforms. If there’s a collider found, no connection is made and the algorithm moves on to the next connection. If there’s no collider, the algorithm makes a connection and moves on.

The thing is, raycasting doesn’t work in edit mode at all.

Expectation:


Result:

When I hit Play and test the very same code, raycasting returns everything as needed, and gives the expected result.

It is worth mentioning that the editor script inherits from Editor (which, in turn, inherits from ScriptableObject), and the raycasting is performed under certain conditions during OnInspectorGUI.
ExecuteInEditMode, ExecuteAlways, etc. didn’t work, nor did a separate MonoBehaviour, as raycasting apparently only updates in the next FixedUpdate, which (to my knowledge) can’t be forced like regular Update.

I could make the mesh in Play mode and then copy the results, but it’s far from ideal.

Any suggestions?

(This is Unity 2019.4.18f1)

Ive never tried this but if you need your script to run in edit mode this might be relevant. Hope this helps.