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 zerox911 · Sep 11, 2012 at 08:39 AM · touchbuttonsaugmented reality

only show GUI.Button when touched at object on augmented reality

based on the title above...

in my scene there is an object with other functions (Raycasting works on this)..

what i want to do is...

when i touched exactly at the object, GUI BUTTONS appear...

and when i touch anywhere outside of the object... it hides the GUI BUTTONS...

ive tried Raycasting on the object, where i it has the same effect on the other functions..

but if failed...

so is there any other way where i only touch the object for a moment.. and some buttons appear out of nowhere..

and when i touch besides the object the buttons mysteriously disappears..??

heres the code where it works on the keyboard..

 function OnGUI  () {
     if(GUI.Button (Rect (Screen.width/2 - 10, Screen.height/2 - 10, 100, 100), "Hello World!")){
     
     }
 }
 
 //this code is in an empty gameobject (myGui)
 
 var Guiscript : myGui;
 
 function Start(){
 
 Guiscript.enabled = false;
 
 }
 
 function Update () {
     
     if(Input.GetKeyDown ("space")){
             if (Guiscript.enabled == true){
             Guiscript.enabled = false;
             }
             else {
             Guiscript.enabled = true;
             }
         }
     }
 

so this code works on the keyboard... im having problems to change it to a touch.. as what i explained before..

thank you.. your patience and your help is and honor...

Comment
Add comment · Show 2
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 whydoidoit · Sep 11, 2012 at 10:59 AM 0
Share

Well raycasting from the camera is the way to go - what didn't work?

avatar image zerox911 · Sep 12, 2012 at 03:49 AM 0
Share

the GUI.Buttons..

if i touch the object and only the object... the Buttons will appear... else if i touch else where besides the object.. the Buttons will disappear..

and its an Augmented Reality project...

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by svenskefan · Sep 11, 2012 at 12:30 PM

Hi! Seems like you have the logic worked out, only need to get the raycast to work properly.

Make sure you have a collider on the object you want to raycast against, and check out the docs for all possible settings you can have for the raycast call.

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 zerox911 · Sep 12, 2012 at 03:50 AM 0
Share

i did that...

and it has no effect at all... to make the Buttons appear that is..

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

10 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

Related Questions

Do UI Buttons work the same for Touch for an Android Game? 1 Answer

Help with touchscreen controls 2 Answers

Rotate model with ARKit 0 Answers

Problem with rect and touch 1 Answer

How do I attach buttons to object (3d plane) ? 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