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 DiGiaCom-Tech · Aug 27, 2016 at 06:36 PM · editorinspectorterraintexture

How do I create a check-able list of terrain textures in the Inspector?

I am creating a script that will only place objects on the terrain that have a specific texture assigned based on selections from a terrain texture list.

What I need is a 'check-able' list of terrain textures in the inspector similar to the Camera Culling Mask list shown below (e.g. Anywhere or just on the selected textures ).

alt text

I know how to get the terrain texture index (and other texture information) at any given point on the active terrain. I'm just trying to make the inspector interface easier to use than simply adding a delimited list of numbers (e.g. 0,3,5) and hoping users get them right. It would be nice to show a thumbnail of the texture (like in the Terrain editor) but I don't want to take up too much real-estate.

Anybody have any ideas, suggestions, and/or code?

camculmask.png (31.3 kB)
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 Glurth · Aug 27, 2016 at 11:36 PM 1
Share

Assu$$anonymous$$g you have a custom editor already, check out https://docs.unity3d.com/ScriptReference/EditorGUILayout.$$anonymous$$askField.html

avatar image DiGiaCom-Tech Glurth · Aug 28, 2016 at 02:34 AM 0
Share

The only problem I see with using EditorGUILayout.$$anonymous$$askField or EditorGUILayout.Enum$$anonymous$$askField is that I need the list to be dynamic in nature. That is, like the 'Culling $$anonymous$$ask' ... when new layers are added the list displays them automatically. $$anonymous$$ine needs to do the same as new textures are added.

I guess that $$anonymous$$askField is the way to go as it has an array that I can stuff with the texture details. Question is, where does this code go ... in the Editor code I assume. Next question is how to update this array when textures are added.

Always something new to figure out ;)

avatar image Glurth DiGiaCom-Tech · Aug 28, 2016 at 08:27 PM 0
Share

Every time you call $$anonymous$$askField you will need to pass in the array of strings that can be selected. If that list changes from one editor update to the next, the displayed options will change. The tricky part is going to be dissecting the returned mask field to see which ones are checked. (you'll want to use bitwise "AND" operator and the shiftright ">>" operator, to loop through all the bits.)

Yes, you would add the EditorGUILayout function to a "Custom Editor" for the $$anonymous$$onobehavior object that contains it.

Not sure how you add textures, so can't address that.

0 Replies

· Add your reply
  • Sort: 

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

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

Related Questions

EditorGUI add SortingLayer-like list to custom Editor 1 Answer

Custom Editor problems 2 Answers

Create inspector drop-down button based on the content of a list in editor mode 1 Answer

Is it possible to drag/drop/increment into editor array? 1 Answer

Unity Editor Inspector creating gameObjects in world 2 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