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
0
Question by Eowyn27 · Dec 12, 2013 at 03:17 PM · meshselectionhighlight

How can I make certain parts of my object selectable?

I have one mesh object. I want the user to be able to hover over a part of the object and then the object will show a prominent color change allowing the user to select or click the region that will eventually have an event listener that goes into another scene or action.

Now I'm just curious as to how I can make certain parts of my ONE object mesh selectable/highlightable?

I can't find any information on this online. Does this mean that I have to chop up my object in various pieces for the user to select a certain region or is there a way to highlight the part of the object without chopping it up?

Also, it seems like one possible way is to add texture overlap on the mesh but I'm not sure if that's really what I need?

The biggest problem is I want the region that's highlightable to be really thin because I want to make it look like a cut in the object was selected.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by robertbu · Dec 12, 2013 at 03:23 PM

One solution is to create a second texture for the object. For each area you want to be able to select, give it a specific color. That is by using different colors, you have the ability to specify different events for different hit areas. Then you can use the the textureCoord from the RaycastHit structure used in the Raycast() to get the color. If the color is a close match to a specified color, then you have a hit for that color and can generate the event.

Comment
Add comment · Show 4 · 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 Eowyn27 · Dec 12, 2013 at 06:27 PM 0
Share

I want to try the TextureCoord script before I manipulate it and it's not working for me. I added the js portion of the provided script to my main camera and nothing happens to my object.

I made sure I attached a mesh collider and a mesh renderer to my object.

avatar image robertbu · Dec 12, 2013 at 07:30 PM 0
Share

I just tested the sample script, and it worked fine. $$anonymous$$ake sure your texture is RGBA32, and that you have it read/write enabled. Note for what I outline above, you don't need a visible texture, nor does the texture need to be the same size. It just needs to have the same aspect ratio. You can use Texture2D.GetPixelBilinear().

avatar image Eowyn27 · Dec 16, 2013 at 05:17 PM 0
Share

How do I make sure my texture is RGBA32 and read/write enabled? I'm a beginner

avatar image robertbu · Dec 16, 2013 at 08:38 PM 0
Share
  • Select your texture in the Project pane

  • In the Inspector pane, set 'Texture Type' to Advanced

  • Turn on 'Read/Write Enabled'

  • Turn off Generate $$anonymous$$ip $$anonymous$$aps

  • In 'Format' select RGBA 32-bit

Other settings will work, but this is a place to start.

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

17 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

Related Questions

A node in a childnode? 1 Answer

C# Preserving GameObjects' Previous Meshes 1 Answer

highlight objects, i really need help pls 0 Answers

Autoscale Shader with multiple random texture selection. 0 Answers

Problem with non convex mesh colliders 4 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