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
-2
Question by EpicGamer928 · Aug 30, 2013 at 02:28 PM · soundstap

Touch Piano

I have a piano layout in unity and I would like to when I touch the keys (tap) it plays a sound until I release. (Like a piano).

I am new to Unity and don't have any code yet.

Thanks in advance!

Comment
Add comment · Show 4
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 EpicGamer928 · Aug 30, 2013 at 02:30 PM 0
Share

By the way the game is for Windows 8 Touch.

avatar image roojerry · Aug 30, 2013 at 02:34 PM 0
Share

Have you looked into Input.touches and TouchPhase. There are examples in the docs, and many many more questions, answers and tutorials around about handling touch input. Google is definitely your friend for this.

avatar image EpicGamer928 · Sep 01, 2013 at 04:07 PM 0
Share

Thankyou for your help. Has anyone got any code as I am not very good at looking at docs and creating code.

avatar image roojerry · Sep 02, 2013 at 11:37 AM 0
Share

The docs give pretty good code samples. If you aren't ready to handle that yet, you should probably shelve this idea for the time being and take on some unity/program$$anonymous$$g basic tutorials. This site isn't a place to ask for scripts, and it would really benefit you to learn the basics, as it only gets harder from here. Good luck.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Narv · Sep 01, 2013 at 10:18 PM

Is this 2d or 3d?

also, place an collided in each key object and a script that on the update function checks the input.tocuhes. Then raycast on touch using camera.main.screenpointtoray and see what collided it hits. Then based on which one it hits, play a sound or whatever it is you wish to do.

Comment
Add comment · Show 1 · 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 EpicGamer928 · Sep 02, 2013 at 11:17 AM 0
Share

It is 2d. I am using planes for the keys but to make it look 2d a orthographic camera.

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

19 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

Related Questions

Sounds looping how to restrict 1 Answer

Networking Gun Fire Sound 1 Answer

Deleting Save Files Created By Unity Serializer 1 Answer

Where to find a simple 2D tutorial of a Bird's Eye View game 0 Answers

How will we enable and disable a gui texture in unity 3d? 5 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