Understanding RuntimeInspectorButton #35
-
Hi - I'm having some difficulty implementing RuntimeInspectorButtons and want to understand if they'll work for my use-case... I'd like to add a custom button to the inspector for any selected object that, when clicked, adds that object to a list for some later post-processing. I have the following static class meant to just test whether or not this approach is viable:
and in a utility script attached to the inspector itself, I have the following in Start():
I'm obviously missing a step, as no buttons appear in the inspector. If the static class encompassing the button-press logic is the wrong approach, do I need to implement these functions in a script that becomes a component on any object I'd like to show the buttons for? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You just need to make the function an extension function. For example, if you want the button to appear when a GameObject is inspected: |
Beta Was this translation helpful? Give feedback.
You just need to make the function an extension function. For example, if you want the button to appear when a GameObject is inspected:
public static void ToggleCollider( this GameObject go )