You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
draw a button for method decorated with [ContextMenu]
Example
The following would draw a button with face text “Do transform”.
When pressed it will call DoTransform().
If its validating method returns false, the button is greyed out and not interactable.
I don't like this idea. I feel it is peppering the scripts with unnecessary helpers.
Perhaps there's some other clever way of doing this though? some sort of editor script that you whack a monobehaviour onto, it uses reflection to show all public void methods and gives you a button for each one?
Yeah that should be possibly via reflection. And I agree, it should be done via another script, one that is editor-only. This will ensure the concerns are separated more easily and by implementing it generically via reflection one allows anything to be called. If there's the need to restrict the methods or offer the predicate feature shown off in the original post, then I'd say it might be possible still - but I'd do so by writing an editor script that is specifically for the type I'm adjusting.
Feature request
draw a button for method decorated with [ContextMenu]
Example
The following would draw a button with face text “Do transform”.
When pressed it will call DoTransform().
If its validating method returns false, the button is greyed out and not interactable.
The text was updated successfully, but these errors were encountered: