Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 Eightbitdaydream · Jun 06, 2016 at 07:13 AM · guimouselookmouseclickgui-button

Why can't i click a button when in first person?

I have made a menu pop up when i press Esc but i cant click the buttons as when i try to click the buttons the mouse disappears. if there is scrip involved in doing this please do it in c#.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by allenallenallen · Jun 06, 2016 at 11:18 AM

That's because the First Person Controller uses MouseLook.cs to lock the cursor to the middle of the screen. I wouldn't use the First Person Controller in the Standard Asset if I were you since it's quite basic.

However, if you really want to keep using it, just uncheck the Lock Cursor option like the image shown right here: http://image.prntscr.com/image/5f0cfff147dc454c9a66c8f67166cf1e.png

Comment
Add comment · Show 5 · 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 Eightbitdaydream · Jun 06, 2016 at 09:33 PM 0
Share

Yes but how could you hide the mouse when in the game but when the ESC button is pressed the mouse become free to click things?

avatar image allenallenallen Eightbitdaydream · Jun 07, 2016 at 02:23 AM 0
Share

Use this:

https://docs.unity3d.com/ScriptReference/Cursor-visible.html

Simply set the cursor to invisible at the start.

Then when ESC is pressed, toggle the visibility.

 Cursor.visible = !Cursor.visible;
avatar image schkorpio · Jul 22, 2017 at 05:31 AM 0
Share

Thanks y'all this was driving me nuts. I thought it was something wrong with my UI! But it's the standard FPS asset that was making my GUI buttons not respond some of the time.

avatar image zeday · Sep 06, 2017 at 12:02 AM 1
Share

@allenallenallen Wow! Thanks for this image/answer. You have no idea how this issue (Lock cursor check box) has frustrated my work for many days. I could not get the FPS Controller to click a button. I was starting to think my laptop was cursed (LOL) and wondering why I was so rubbish at simple UI buttons when everyone seems to get it.

Now, it works like magic. $$anonymous$$any thanks once again!

avatar image alirazabrame · Oct 05, 2021 at 10:35 AM 0
Share

Uncheck FPS controller mouse lock. This works for me! Thanks

avatar image
0

Answer by PokerBob · Oct 26, 2019 at 06:14 PM

OMG its become clearer now, after struggling for a day to be able to click a ui button after checking all the raycasting whatnot's and attached components seemingly correct, i now know the issue (i think) is with the FPS looking in the wrong place and can work around it - many thanks for the pointer.

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

11 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

Related Questions

GUI based character control 2 Answers

Can I change GUIButton behaviour? 1 Answer

Buttons that remove themselves when clicked mess up other gui elements 2 Answers

Change button texture when its clicked 1 Answer

Is it possible to detect which GUIStyleState is used? 2 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