Hi,
I would like to display a GenericMenu
after clicking a contextual MenuItem
in the options of a component.
I do not want to use the “new” input system here, as my project doesn’t use it (and it complicates things when I would ever make an asset store asset out of it).
The GenericMenu
has the option ShowAsContext()
which uses Event.Current
for the latest mouse position. This would be fine for me.
However, the Event.Current
is null at the time I open the menu, as I am not in the OnGUI()
loop.
My idea was storing the latest event in a variable and using that instead. I have to do that during the OnGUI()
loop which is a bit tricky, as I just have static methods. I managed to do this by registering to SceneView.duringSceneGui
and this works fine.
The only problem is, that if the scene view is not open, this does not work. I can be sure that the inspector is open at that time, so I wonder if there is a similar event I can register to for the inspector?
Or does anybody know a different solution to this problem?