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 Bananaman · Nov 17, 2012 at 01:05 AM · raycast

How do I make an Android touch main menu?

I've been looking for a while now and I haven't been able to find anything really helpful. So I'm trying to make a 3d main menu with a play button and a quit button. For each button (cube with attached 3d text)I would like it to be where when you touch it, it loads a scene or quits the application. I've seen people using raycasting which I have no idea how to use as I am a novice coder. Is that the proper way to call upon an object in the scene. If so, what's a code that I could use for this function?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Kale · Nov 17, 2012 at 07:15 AM

I don't know about Android stuff but... Here's a start.

Look up raycasts, like you mentioned people have used. It literally casts a ray from one point to another. In cases of touchscreens and mice, you set it up to cast a ray from the point where you touch or click to a deeper spot in the scene. Then from there, you get the object that you hit to do something much like collision.

It seems you might be reaching way over your head at this point to look at making a menu without knowing at least the basics of raycasting, which would probably be at the core of any touchscreen or clicking game/app.

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

Answer by Bananaman · Nov 17, 2012 at 06:57 PM

Well before I just used OnMouseDown and so on for Pc games. But I looked at all the information on raycasting and touch input and got the whole thing running. Thanks!

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

Answer by LinuxHacker · Jun 18, 2013 at 10:26 AM

try using this script; attach a colider to the object you want to turn into a button and try it....

 var levelToLoad : String;
 
 var soundhover : AudioClip;
 
 var beep : AudioClip;
 
 var QuitButton : boolean = false;
 
 function OnMouseEnter(){
 
 audio.PlayOneShot(soundhover);
 
 }
 
 function OnMouseUp(){
 
 audio.PlayOneShot(beep);
 
 yield new WaitForSeconds(0.35);
 
 if(QuitButton){
 
 Application.Quit();
 
 }
 
 else{
 
 Application.LoadLevel(levelToLoad);
 
 }
 
 }
 
 @script RequireComponent(AudioSource)


u can use this video also :http://www.youtube.com/watch?v=Z8YGKQvEz1Y

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 Graham-Dunnett ♦♦ · Jun 18, 2013 at 10:26 AM 0
Share

Please learn how to format code.

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

12 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

Related Questions

Raycast doesn't update 1 Answer

Unity c# Raycast axis stuck on one axis 0 Answers

Raycast lines debug problem 1 Answer

How to make sure that the raycast points in the right direction? 1 Answer

NavMesh AI: follow only if seen 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