Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by MaT227 · Sep 03, 2015 at 08:35 PM · c#editorinspectorcustom-inspector

Unity Custom Editor Texture Warning

Hi there,

I would like to know how can I display a texture warning according to the texture type. Is it possible to display a warning depending on the selected texture type (Texture, Normal, GUI, etc.) ? How ?

 Texture2D t = textureProperty.objectReferenceValue as Texture2D;
 t = EditorGUI.ObjectField(rect, t, typeof(Texture2D), false) as Texture2D;
 textureProperty.objectReferenceValue = t;
 // if the texture is Normal, GUI or whatever, display a warning or anything.

Thanks a lot.

Comment
Add comment · Show 3
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 MaT227 · Sep 03, 2015 at 08:47 PM 0
Share

Thanks for your answer, I already saw that but it needs to always import the texture and I don't think that its good for performances even in the Editor.

avatar image Positive7 · Sep 03, 2015 at 09:12 PM 0
Share

Just tested and it works, I'm not sure how performance hungry this thing. I don't know any other way to do that.

avatar image MaT227 · Sep 03, 2015 at 09:23 PM 0
Share

Alright, thank you. I've accepted your answer but you could maybe add some details.

2 Replies

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

Answer by Positive7 · Sep 03, 2015 at 08:41 PM

http://docs.unity3d.com/ScriptReference/TextureImporter.html

TextureImporter.textureType; in if() statement should do the trick. Haven't tried it yet.

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
1

Answer by Jessespike · Sep 03, 2015 at 08:59 PM

TextureImporter.textureType

TextureImporterType

Comment
Add comment · Show 5 · 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 MaT227 · Sep 03, 2015 at 09:01 PM 0
Share

Right but as I said in the comments, it needs to always import the texture and I don't think that its good for performances even in the Editor.

avatar image Jessespike · Sep 03, 2015 at 09:09 PM 0
Share

Performance should be fine.

avatar image MaT227 · Sep 03, 2015 at 09:13 PM 0
Share

I thought that there was a better or elegant way than searching for the path, Importing the asset, creating the TextureImporter etc. inside on GUI even if we can check for any change to reduce performance costs.

avatar image Jessespike · Sep 03, 2015 at 09:23 PM 0
Share

Assets aren't actually imported until you call SaveAndImport() or AssetDatabase.ImportAsset(), reading a path then reading textureSettings shouldn't cause performance issues.

avatar image MaT227 · Sep 03, 2015 at 09:24 PM 0
Share

You're right, thank you for your answer.

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

28 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 avatar image avatar image avatar image avatar image

Related Questions

How to change inspector with non-Monobehaviour objects ? 1 Answer

Unity Editor - Class variable value contrain 4 Answers

Drawing a custom variable in the inspector y position bugs selection 0 Answers

ReImport in c# of GameObjects only for Scene Objects, not assets? 1 Answer

Custom Inspector - How to add functionality? 1 Answer


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