Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
5
Question by vexe · May 06, 2014 at 01:54 AM · editor-scriptingproperty drawer

Is it possible to draw more than one property attribute on a field?

So I'm writing a full set of property drawers when I noticed that if I use more than one attribute on a field, only the last attribute will get drawn.

alt text

I want both the comment and the foldout to appear. Is multiple attributes drawing supported? - If so, any idea how to achieve it?

I'm not looking for work-arounds, I could easily write a ShowTransformWithComment

Thanks.

untitled.png (29.8 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Clet_ · May 06, 2014 at 03:45 AM 0
Share

Could you post your AtttributeEditor scripts? I would get a better idea of what's going on

1 Reply

· Add your reply
  • Sort: 
avatar image
5
Best Answer

Answer by vexe · Jun 05, 2014 at 11:29 AM

Turns out it is possible. I'm not sure if it was previously there in Unity 4.3 but I just found out about the order property that's in PropertyAttribute. So now you can composite/decorate attributes like:

 [Comment("This is a comment"), order = 0]
 [ShowTransform, order = 1]
 public Transform t;

Just make sure the order makes sense.

Also worth mentioning that Unity changed the way they deal with properties internally. They now have a PropertyHandler from which PropertyDrawer and PropertyDecorator inherit from. I'm happy Unity did something right and implemented composition.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image v01pe_ · May 17, 2016 at 12:56 PM 0
Share

Nice thanks for that, also didn't know that DecoratorDrawer exist. $$anonymous$$inor corrections:

 [Comment("This is a comment", order = 0)]
 [ShowTransform(order = 1)]

and name of the class DecoratorDrawer. Yet this still doesn't allow me to add multiple PropertyDrawers to one field? Sooo close

avatar image TMPxyz · Oct 06, 2017 at 09:41 AM 1
Share

It seems to work well with DecoratorDrawer, but is there a method to make it work with PropertyDrawer?

I've made a drawer for $$anonymous$$atrix4x4 to draw it in a 4x4 float fields, and I've a [ReadOnly] drawer to make fields read-only;

When I add a [ReadOnly] on a $$anonymous$$atrix4x4 field, the readonly works, but the custom & native $$anonymous$$atrix4x4 drawers both malfunction.

avatar image Meepolisk TMPxyz · Oct 27, 2017 at 08:00 PM 0
Share

I$$anonymous$$G I ran into the same problem with you. I got a simple class with 2 field, use custom property drawer, and a custom attribute to disable a field if there is no match required-component. Did anyone solved this problem?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

24 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Losing Class References 0 Answers

Property Drawer and Inheritance 0 Answers

Custom property drawer for generic 0 Answers

ScriptableObject PropertyDrawer ArgumentOutOfRange Exception 0 Answers

Using EditorGUI.ObjectField in PropertyDrawer 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges