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

Conditional UnityEvent inspector is broken #24

Closed
nipunasudha opened this issue Jul 20, 2019 · 8 comments
Closed

Conditional UnityEvent inspector is broken #24

nipunasudha opened this issue Jul 20, 2019 · 8 comments

Comments

@nipunasudha
Copy link

My attempt to conditionally show/hide an UnityEvent field failed.
image

The inspector is broken like this
image

@Deadcows
Copy link
Owner

Yep, actually there is no way to draw custom property drawer inside of property drawer. So any property with fancy inspector appearance will be drawn as a plain data :(

Like with arrays, it's just the way unity works.

@Deadcows
Copy link
Owner

...buuut I found this thread on how to hack the engine to make it done, so maybe there is some hope :)

// I'll check it a bit later
https://forum.unity.com/threads/drawing-default-property-drawer-in-a-custom-property-drawer.197268/

@woistjadefox
Copy link

Works in my case. Is it already fixed?

@Deadcows
Copy link
Owner

Deadcows commented Jan 16, 2020

Are you sure you checked on UnityEvent?
Tested it now and it looks like this:

	public bool A;
	[ConditionalField("A")] public UnityEvent B;

image

ConditionalField should handle most of the types now, but still struggles with such types like UnityEvent, which have Custom Drawer and base class

@woistjadefox
Copy link

Yes it's working:

image

image

I use Untiy 2019.3.0f3 maybe that's the reason why?

@woistjadefox
Copy link

Ahh.. sorry found out why. I use a custom property drawer for UnityEvents:
https://gist.github.com/ByronMayne/70a46e73f3af7fb9fec7437174dd4858

@Deadcows
Copy link
Owner

Whoa 😲. I never thought of possibility to extend existing custom drawers this way! Maybe I'll contact Bryon to embed this one in MyBox. Thanks for bringing this up 👍
Quite a few of interesting ideas he's got there btw

@Deadcows
Copy link
Owner

Finally! Now UnityEvent works with ConditionalAttribute and comes with a few nice improvements! Thanks to the Bryon, almost after half of a year I'm able to close this issue 😁

@woistjadefox, you probably should remove your CollapsableEventDrawer.cs before you'll grab the latest commit of MyBox

image

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

No branches or pull requests

3 participants