-
Notifications
You must be signed in to change notification settings - Fork 83
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
Replace System.Object
with UnityEngine.Object
in Editor.Button.Draw
#21
Conversation
Nice find! Really awesome PR <3 I will check this out when I get home. Also pinging @SolidAlloy just to be sure this is indeed correct. |
I agree the only objects that can be passed at the moment are of type The problem with casting arrays of |
If that's the case, I would suggest there be a public-facing overload that's friendly with Either that, or make If we go with generics, I think it's not hard to keep the existing |
Thinking about it some more, I'm okay with the If you feel the generic implementation is overly complex, your solution does solve my use case. |
@madsbangh I made #22 so that you can pick which implementation you want to go with. Just merge the one you want and close the one you don't. If there are any other necessary changes I'll be happy to make them in either branch. |
Specifying a type like I'm not against Still, I like The final word is on @madsbangh , of course. |
You would need to create a generic type with My thinking was along the lines of how This is just how I would write it, if I were planning on making it extensible. I think you have the right idea when you say:
|
I'm actually going to go ahead and close this because I think #22 provides a cleaner solution in the short-term and is more extensible in the long-term. |
Thank you @ribbanya and @SolidAlloy :) I think this is the right choice. I like to keep things simple and add complexity when needed, so yeah! #22 keeps the code as simple as it is now, while increasing usability 👍 Awesome ❤️ |
The type of
Editor.targets
isUnityEngine.Object[]
, notSystem.Object[]
. Attempting to implicitly convertObject[]
toobject[]
causes Rider to complain (and it's not great practice anyway).The alternative to this PR is what I'm currently doing in my code, which I'd rather not: