Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button improvements #79

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.

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.

None yet

1 participant