Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by moghes · May 04, 2012 at 11:12 AM · buttonsguitextureonmousedownattach

Adding script to Gui Texture

I have to gui textures that are arrows, and I want them to become buttons. I just attached the script to the gui texture in the heirarchy, after I run the game, the script is activated whenere I click any place in the screen and not just on the gui texture.. What might be the problem?

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 Bunny83 · May 04, 2012 at 11:13 AM 0
Share

The problem is that you didn't posted your code...

avatar image moghes · May 04, 2012 at 11:20 AM 0
Share

Here's the code:

var speed:Number = 10; public var globe:Transform;

function Update () {

if(Input.Get$$anonymous$$ouseButtonDown(0)) globe.Rotate(Vector3.left Time.deltaTime 100 , Space.Self);

}

and I have attached this code to my gui texture in the heirarchy

avatar image venkspower moghes · May 04, 2012 at 11:35 AM 0
Share

But where have you defined your "ARROWS" which are GUITexture?

avatar image moghes · May 04, 2012 at 11:45 AM 0
Share

venkspower: The Gui texture is in the heirarchy

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by aldonaletto · May 04, 2012 at 11:24 AM

You should use OnMouseDown - Input.GetMouseButtonDown is reported when the user presses the mouse button, no matter where, while OnMouseDown only occurs when the object (GUIText, GUITexture or collider) is clicked.

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 moghes · May 04, 2012 at 11:26 AM 0
Share

Thank you! I am still new to Untiy

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Draw Button with GUITexture which looks like Unity button 1 Answer

How to have attach and detach Fixed Joints on objects with UI button through Oculus?,How to break fixed joint in a command? 0 Answers

Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer

Please help with player selection screen 2 Answers

GUITexture buttons in Android are too sensitive 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