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

support easy buttons #356

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Artemis-chan
Copy link

@Artemis-chan Artemis-chan commented May 12, 2023

This PR simply tries to find EasyButtons assembly and draws the buttons in the NaughtyInspector through that, if the user does not have EasyButtons installed it acts normally.
This is to basically get access to Buttons with parameters and NaughtyInspector overrides drawer from EasyButtons, while using EasyButtons as kind of a plugin for NaughtyAttributes.

It might need a editor restart in my experience if EasyButtons is installed after this.

Though if usage of separate EasyButtons assembly is not wanted, I can write support for the button params separately without any external dependencies some time in the coming weeks.

@ZeroUltra
Copy link

👍👍👍

@Kryloth
Copy link

Kryloth commented May 16, 2023

@Artemis-chan
Can you help me man ?
Everytime i restart the project, the easy button on the inspector is gone for some reason
i've applied this changes too, reinstalled the easy button and naughty attributes
but when i close and reopen the project, the button on the inspector is always gone

@Artemis-chan
Copy link
Author

Artemis-chan commented May 17, 2023

@Kryloth How did you install the packages and which Unity version? And are you sure reinstalling did not revert the changes?

Also could you try adding this git package https://github.com/Artemis-chan/NaughtyAttributes.git?path=Assets/NaughtyAttributes#easy-button-support after uninstalling base NaughtyAttributes.

@Kryloth
Copy link

Kryloth commented May 17, 2023

@Artemis-chan I'm installing on Unity 2021.3.22f1, i'm sure that what i installed didn't revert the changes since i took a look at the NaughtyInspector script and there's your changes in there
i even added a debug log to indicate if it's a success just to make sure everything is fine

if (!BindEasyButtonDrawer())
{
    Debug.LogWarning("EasyButtons drawer definition does not match");
}
else
{
    Debug.Log("EASY BUTTON SUCCESS");
}

At first when i just installed both the Naughty and Easy, it all works fine and the code even logs the debug
but whenever i close unity and open it again, all of a sudden the code doesn't work anymore, the button is nowhere to be seen and it doesn't throw the log anymore not even the one with the warning

If you want to i could show you more from my discord, hit me up at Kry#1580

@Kryloth
Copy link

Kryloth commented May 21, 2023

@Artemis-chan
Hello are you still here ?
can you please help me ?
i'm not sure what else to do and i've tried all things i could think of but it's still doesn't work
please i really need this functionality for my work

@Artemis-chan
Copy link
Author

@Kryloth please be patient, I was busy then taking a break.
Could you tell me how exactly did you install the plugins?
And did you trying installing the git package I linked?

@Kryloth
Copy link

Kryloth commented May 22, 2023

@Artemis-chan oh no worries, sorry i thought you might be forgotting
I cannot install it from the git package straight from unity package manager for some reason
so i installed it by downloading the files from that git link and importing them manually into unity

@Artemis-chan
Copy link
Author

@Kryloth oh sorry there was typo in the link try this https://github.com/Artemis-chan/NaughtyAttributes.git?path=Assets/NaughtyAttributes#easy-button-support

@Kryloth
Copy link

Kryloth commented May 22, 2023

@Artemis-chan
It works only for the first time after i installed it, if i restarted unity it doesn't work anymore
Before
image

After
image

@Artemis-chan
Copy link
Author

@Kryloth could you create a new project with the issue present and send me that in a zip file? Just a empty project with just the issue reproduced. I can't seem to produce it.

@Kryloth
Copy link

Kryloth commented May 23, 2023

@Artemis-chan
Okay first of all let me apologize.., turns out the problem was because in addition to NaughtyAttributes
i also use another plugin called MyBox because it has some functionalities that i wanted that isn't in NaughtyAttributes

Looks like i'll have to choose between MyBox and NA with EasyButtons 😞

@Artemis-chan
Copy link
Author

@Kryloth no worries at least you found the cause.
Yeah, can't do anything about this that other plugin seem to have a lot of overlapping functionality with NA and takes control of Inspector instead.

@imniko
Copy link

imniko commented Jul 29, 2023

It is possible to use all 3 on a single project, although with some compromise (foldouts being drawn out of order), the changes are not straight forward as all 3 package source need some changing.

The basic idea is to have only one script with [CustomEditor(typeof(Object)] in the whole project. then merge the contents of UnityObjectEditor.cs (MyBox), ObjectEditor.cs (EasyButtton) and NaughtyInspector.cs into one file.

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.

4 participants