Alchemy
Alchemy copied to clipboard
Button improvements
Pretty prints method name with ObjectNames.NicifyVariableName()
, and adds the method signature as a tooltip:
[Button]
void reticulateSplines() {
Debug.Log("Reticulating splines...");
}
Allows displaying a button with parameters as a simple button instead:
This will use default parameters when those are specified in the method signature.
[Button(useParameters: false)]
void PerformAction(string ignorableParam, int number = 100) {
Debug.Log($"{number} {ignorableParam}s.");
}
Also fills default parameters when specified, for the normal invocation foldout:
[Button]
void MoreMethod(int numberOfFoos = 50) {
Debug.Log($"FooAmount: {numberOfFoos}");
}
Some other areas I'd like to improve and may get to:
- Selecting different size buttons (increase button height and font size)
- Making the placement of buttons in the inspector more intuitive - they currently will always display before any TabGroup or FoldoutGroup fields, which usually feels weird. Trying to put them inside those groups will also affect the layout unpredictably. See #80
I haven't tested this extremely thoroughly yet, and obviously there should be a documentation update alongside these changes.