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 coolthemanp6p · Jan 13, 2012 at 09:18 PM · guimaparea

How can I make the click area on a GUI texture a different shape?

Ok let me explain this so you not confused. Let's say your making a map of America. You want to be able to click on each individual state for info or something. I don't want images interfering with each other. Any help?

Edit:

I searched all over google and youtube!

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

Answer by roamcel · Jan 13, 2012 at 10:00 PM

I believe your best call is to render the map on a simple plane, and put it on the 'Ignoreraycast' layer, so that raycasts 'go through it', then just behind the plane with the map, you place actual colliders, for example from prefabbed objects that have a script with a public variable 'statename'.

This should be enough to put you on the right track.

Comment
Add comment · Show 6 · 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 coolthemanp6p · Jan 13, 2012 at 10:18 PM 0
Share

The on;y problem is I would have to put many colliders down for 1 state because states aren't square. At least no most of them

avatar image coolthemanp6p · Jan 13, 2012 at 11:11 PM 0
Share

I also want it to be 2d anyway?

avatar image roamcel · Jan 14, 2012 at 06:26 AM 0
Share

You are correct about the multiple collider issue but alas, the other choice is creating meshes for every single area, and using a 'mesh collider' on them. You see there's no way to avoid colliders if you need to interact with your objects. Regarding 2D, you will just need to set your cameras to 'orthographic' to render correctly in 2D.

avatar image Tasarran · Jan 14, 2012 at 06:33 AM 0
Share

They don't have to be a perfect fit, either. You could have some small gaps around the edge, no problem.

In my hex-based game, the colliders for the tiles are all spheres, there's a gap around the edge, but it helps avoid ambiguity.

avatar image coolthemanp6p · Jan 15, 2012 at 07:01 PM 0
Share

I never tought of orthographic rendering so thanks

Show more comments
avatar image
0

Answer by robertbu · Oct 09, 2014 at 11:55 PM

You can do this by using a mask with colors. The following answer should get you most of the way there:

http://answers.unity3d.com/questions/516609/empty-spaces-in-buttons-are-detected-by-mouse.html

If you want GUI, make sure to look at the GUI solution in the comment as well as the real-world solution. And if I was not clear, the image with colors for testing does not have to be the same resolution as the original...just the same aspect.

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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to Create a Multi Floor Mini Map 1 Answer

GUILayout.Button scales texture wrong 0 Answers

GUI area vs group 1 Answer

Help with minimap 1 Answer

Map Camera 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