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 Mat Brummitt · Apr 27, 2010 at 09:49 PM · iphonetouchspritemanagerhittest

Detecting Click/Touch in Unity iPhone (SpriteManager)

Hi all,

I apologise now if this question doesn't belong here given that it's related to SpriteManager.

I'm using SpriteManager for all of my on-screen graphical elements and I need to be able to detect touches on my sprites, for the sake of screen progression and interface interactions (muting auto for example, by clicking on the audio sprite). Each sprite is attached to its very own plain GameObject, currently with no way of detecting a hit on a sprite. In the past I have used GUITextures which come with a 'HitTest()' method. Sadly, the current project i'm working on requires a LOT of sprites, so GUITexture is too inefficient this time around because of the draw calls.

Any advice greatly appreciated as always.

Thanks

Mat

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 Brady · Oct 06, 2010 at 02:17 AM

There are a couple of ways to go here. For one, EZ GUI operates seamlessly with SM2 (though it does not require it) to do sprite-based UI like it sounds like you are wanting to do. However, if you want to use strictly SM2, you can add a collider to your sprite object and then do a raycast from the point that was touched. Just get the touch or mouse click, and then use your camera's ScreenPointToRay() to get a Ray from the touched point, and then pass this to Physics.Raycast() and from there you can find out info on what was hit, if anything.

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

No one has followed this question yet.

Related Questions

All objects response to one touch 1 Answer

translating a touchDeltaPosition from the y axis to z axis 1 Answer

GUITexture Active and Enabled=false but still ı can click 1 Answer

Detecting Touch on Iphone and Android 1 Answer

Analogue OnMouseUp for iOS(Unity iPhone) 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