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 ysleungrockman · May 01, 2014 at 05:25 PM · androidbuttonbuttonsguitexture

GUITexture buttons in Android are too sensitive

I am making an android game. I use GUITexture to make buttons. But for some of the buttons, when it is tested on an Android phone using apk file, the button pushed make another button in same position in the next scene or another button which will transform to the same position pushed. I use System.Threading.Thread.Sleep to make some delay to prevent this but some doesn't work especially for the buttons which will transform. How can I solve this problem?

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 Kamuiyshirou · May 01, 2014 at 05:28 PM 0
Share

Your question is confusing. You want after pressing the button1 button2 appear? But button2 should appear in the next scene, after a load.level in the same position of the button1?

avatar image ysleungrockman · May 01, 2014 at 05:49 PM 0
Share

@$$anonymous$$amuiyshirou button2 is in the same scene with button1 but its position is (1000, 1000, 0). button1 is (0, 0, 0). After pushing button1, button2 will change to (0, 0, 0) and button1 will change to (1000, 1000, 0).

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by perchik · May 01, 2014 at 06:17 PM

Perhaps you should do your changes when the button is unpressed. For example, getting key events, Input.GetKeyDown fires when the button is pressed down, Input.GetKeyUp fires when the key is released. I think you need to implement something similar for your buttons.

To implement this, it seems like having two boolean flags should work:

 //pseudocode:
 Start{
     btnWasPressed=false
     btnPressed=false
 }
 
 
 OnGUI{
 
    if(btn)
    {
        btnPressed= true
    }
    if(wasBtnPressed && !btnPressed)
    {
        //change buttons
    }
 
    wasBtnPressed = btnPressed
 }


That way, wasBtnPressed tells you if the button was down last frame. If it was down last frame, but not this frame, then the button has been released.

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

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

Related Questions

how to check if touching an guitexture android 0 Answers

How to make a No Ads Button 0 Answers

pause and restart button on android 1 Answer

I Need a script for a guitexture enableing a spotlight and play a sound when pressed 1 Answer

Unable to reactive the game object 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