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

[EditorButtonAttribute] Method call not work in nested class. #44

Open
SirLpc opened this issue May 19, 2022 · 4 comments
Open

[EditorButtonAttribute] Method call not work in nested class. #44

SirLpc opened this issue May 19, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@SirLpc
Copy link

SirLpc commented May 19, 2022

class RootClass : ScriptableObject
{
public NestedClass childObj;
}

[Serializable]
class NestedClass
{
[EditorButton(nameof(CallMyMethod))]
public string testField;

// Method here in nested class wont be called, but in the parent ScriptableObject will work.
private void CallMyMethod()
{
     // Will not be called, but expected!
}

}

@arimger
Copy link
Owner

arimger commented May 19, 2022

Yup, I know. Unfortunately, decorators have no idea on which properties they are displayed, that's why [DynamicHelp] and [EditorButton] won't work in nested classes. I have this on my TODO list, but thanks for the issue anyway.

@arimger arimger self-assigned this May 19, 2022
@arimger arimger added the enhancement New feature or request label May 19, 2022
@SirLpc
Copy link
Author

SirLpc commented May 19, 2022

Yup, I know. Unfortunately, decorators have no idea on which properties they are displayed, that's why [DynamicHelp] and [EditorButton] won't work in nested classes. I have this on my TODO list, but thanks for the issue anyway.

OK, get it!

@FredTA
Copy link

FredTA commented Oct 1, 2024

I've just bumped into this too, it would be great if buttons in nested classes could directly invoke methods in those same nested classes... is there a way to do it without putting a proxy method in the root class? Something like

[EditorButton("myNestedClassInstance.MyMethod", "Do the thing", activityType: ButtonActivityType.OnPlayMode)]?

@arimger
Copy link
Owner

arimger commented Oct 1, 2024

Thanks for the suggestion. Currently, there is no way to do this but I think I can implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants