Open fight4dream opened 4 years ago
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.