- Home /
Inspector public property context menu
Hey there,
I'm trying to recreate a context menu by right clicking on any kind of public property showing up in the inspector.
The same kind of menu that you can have by right clicking on a property of an instantiated prefab.
I need it to work on every variable in the inspector so everything "class custom editor" related won't work for me.
Maybe using something like what unity can do with the [MenuItem] attribute and the "CONTEXT/Class" key words (https://forum.unity3d.com/threads/solved-adding-context-menus-to-game-object.410353/ which is not documented ...) that will call a static function where I can work with that context (context that would be the property pointed by the mouse when creating the context menu).
Image of the context menu created by right clicking on a property of a Component part of a prefab
Thanks for the help !
What is it that you want the context menu to do/have exactly??
Simply call a static function where I'll be doind stuff with the property. It's juste a matter of getting the property context :)
Answer by Jens_Restemeier · Jul 28, 2020 at 01:46 PM
I just looked at the same thing. You probably want https://docs.unity3d.com/ScriptReference/EditorApplication-contextualPropertyMenu.html