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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by davidinho · Aug 11, 2014 at 01:37 PM · input managermouse click

Can I use the Input Manager with a specific "area click"?

Hi all, I'm a beginner I would like to use Input Manager with no a specific key but with a specific "area click"... I mean, I would that if there is a click on the right half of the screen the axis increment to 1, else if there is a click on the left half of the screen the axis decrement to -1 Is this possible?

I hope I explained myself

Sorry for my very poor english

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Scribe · Aug 11, 2014 at 01:52 PM

Hi there David!

I'm not sure you can do that with the Input manager however you can do it quite simply through code using Input.mousePosition

 if(Input.GetButtonDown("Fire1")){
     if(Input.mousePosition.x < Screen.width*0.5){
         Debug.Log("left side of the screen clicked!");
     }else{
         Debug.Log("right side of the screen clicked!");
     }
 }

Scribe

Comment
Add comment · Show 3 · 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 davidinho · Aug 11, 2014 at 03:03 PM 0
Share

yes, but in this way I don't have parameters like "gravity" or "sensitivity"... right?

avatar image Scribe · Aug 11, 2014 at 03:50 PM 0
Share

I'm afraid I don't know why this would stop you having gravity or sensitivity. I probably need to see your current code to understand what you mean. This is just a way of checking where you are clicking, it has nothing to do with gravity or sensitivity?

avatar image davidinho · Aug 11, 2014 at 05:05 PM 0
Share

well, gravity and sensitivity are parameters that are setted in the Input manager

anyway, I solved setting in the input manager only positive button with parameter "mouse 0" then in the code I used your code in this way:

 if(Input.mousePosition.x < Screen.width*0.5){
     this.transform.Translate(new Vector3(-Input.GetAxis("Horizontal") * Time.deltaTime, 0f));
     }
 else{
     this.transform.Translate(new Vector3(Input.GetAxis("Horizontal") * Time.deltaTime, 0f));
     }

so with the position i decide if the player must go to the left or to the right

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to detect inputs with New Input System while game is unfocused? 1 Answer

Function GetButton only returning once? 2 Answers

How does sensitivity, in input manager, affect joystick axis? 1 Answer

Player Input Action Map is being deleted when I import prefab to the scene 0 Answers

Click on Arrows to Move 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