Skip to content

Conversation

@Petethegoat
Copy link

@Petethegoat Petethegoat commented Mar 26, 2024

Pretty prints method name with ObjectNames.NicifyVariableName(), and adds the method signature as a tooltip:
image

[Button]
void reticulateSplines() {
	Debug.Log("Reticulating splines...");
}

Allows displaying a button with parameters as a simple button instead:
image
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:
image

[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 Inspector element order is unpredictable with PropertyGroups #80

I haven't tested this extremely thoroughly yet, and obviously there should be a documentation update alongside these changes.

Also add tooltip with the method signature, pretty print the method name
( doThing() -> Do Thing ), and make method buttons that do have parameters use any default parameters in the invocation foldout too.
@Petethegoat
Copy link
Author

Remade the pull request with only the intended commit.

@Petethegoat
Copy link
Author

Do let me know if I can provide anything to help get this merged. Happy to update docs for it if you find the features useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant