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
1
Question by Hoeloe · Sep 07, 2013 at 04:29 PM · shadereditorinspectorhide

Shaders - hiding property in inspector

So I have a somewhat unique problem. I have some really awkward shaders that I'm using for a very specific purpose, and one of the things they require is a "dummy texture". Essentially, this is a texture that exists, but doesn't need to be set. The purpose of this is to trick part of Unity's rendering system, so I can use it as a work around to achieve what I need. Now, what I'd really like to do is keep this dummy texture completely under the hood. That is, hide it in the inspector. I noted that some of the terrain shaders had some properties marked with [HideInInspector], but this didn't seem to work. I then had a look at custom material editors. While these will work, I have quite a few different shaders using this, so I'd rather not have to right a custom editor for each one, just to ignore one property. I did wonder if there was a way to exclude the property from the default inspector drawing through a custom editor, since that way I could use the same one for all the shaders, but I couldn't find anything. I also considered dynamically searching through a list of the shader properties, but I don't seem to be able to do this, either. Can anyone help me do this, or is my only solution to write an editor for each shader?

Comment
Add comment
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

2 Replies

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

Answer by Hoeloe · Sep 09, 2013 at 02:54 PM

After a bit of digging into Unity's documentation, I found the source code for Unity's default MaterialEditor. From there, I found I could use ShaderUtils to grab a list of all properties, and have it exclude one the parts I wanted it to.

Comment
Add comment · 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
2
Wiki

Answer by SergeantBiscuits · Feb 08, 2015 at 07:04 PM

Put "[HideInInspector]" behind your property and it won't show up in the inspector. I use this for script-driven shields in my game where I want to be able to set the alpha from script but don't want me or my artists worrying about the alpha.

 Properties {
     _FillColor ("Main Color", COLOR) = (1, 1, 1, 0)
     _RimColor ("Rim Color", Color) = (0.26, 0.19, 0.16, 0.0)
     [HideInInspector]_Alpha ("Alpha", Range(0.0, 1.0)) = 1.0
 }

You'll be able to se _FillColor and _RimColor in the inspector, but _Alpha doesn't show up.

alt text


capture.jpg (13.3 kB)
Comment
Add comment · Show 1 · 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 Hoeloe · Feb 08, 2015 at 07:31 PM 0
Share

Did you read my question? [HideInInspector] didn't work.

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

16 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

Related Questions

Assign texture to shader bypassing material (in Unity Editor) 1 Answer

Hiding scripts from monoscript selector 1 Answer

Custom tree-like editor 0 Answers

Is it Possible to Make RequiredComponents appear at the bottom of all components in the Inspector Window? 0 Answers

Unity inspector scripting - scriptable objects - card game 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