- Home /
Mouse Click vs. TrackPad click
I am having issues with a lot of the Assets I am downloading. I do not want to give them a bad review, if it is my mistake.
Many times, when they say Click Anywhere to move your Unit, my Unit just deselects. And if they say Right-click to move unit, I would normally use Ctrl-Click or Command-Click to do the same thing, but ... again... it just deselects, or does nothing at all. Is there a setting in Unity to use the MackBook TrackPad clicks, or do have to buy a USB Mouse to use Unity?
Please help, this is getting frustrating, and expensive.
Thanks.
The answer is simple. Use mouse! You will not suffer anymore)
Answer by robin-gallimard · Feb 24, 2016 at 05:49 PM
@fishZombie, I might be late to the party, but for future reference:
If you're using a MacBook with a Trackpad, my set up is:
Input.GetMouseButtonDown(0) -> normal TrackPad click
Input.GetMouseButtonDown(1) -> Two fingers tap or two fingers click on the Trackpad
To enable the Two fingers click got to: System preference -> TrackPad -> Point & Click -> Enable Secondary click: Click or tap with 2 fingers
And voilà, secondary button works for Macbooks.
Hope this helps (someone, somewhere)
Answer by fishZombie · Aug 10, 2014 at 12:23 PM
For those of you who like to do your programing on a Mac lapTop, Unity may not be the best solution. The Unity Software uses all the standard Key clicks that you are used to when using mac, or LapTops, but several (most) of the developers of the assets you will run into, seem to either not take Mac into account, or restrict it on purpose (not sure why they would do this).
Mac uses a single button mouse. PC uses 2-8 button mouse, with most using 3. Mac adapts to this with Ctrl-Click. Ctrl-Click serves the same purpose as Right-Click on a PC mouse. 99.99% of software ported to Mac, uses this solution.
I have downloaded several (over 10) assets from the Unity Asset Store, and had most fail on my lapTop (MacBook Pro), due to non-responsive clicks. The assets allow me to Click on something, but when it requires a Right-Click, the standard Ctrl-Click (you would use on Mac), is not accepted.
To get around this, you need to mess with the Input Receiver Scripts that come with the asset. There are several on the assets store, and (so far) not one is just drag-and-drop. All require you to edit the script so that it will work for whatever asset you want to use. This gets VERY frustrating when downloading multiple assets, to figure out which works best for your needs. When just fighting the Click, I never get to see the full functionality of what their asset can do.
The simple work-around (not so simple), is to use a 2+ button USB mouse. But… this kills the idea of working on a lapTop. You now need to carry around a mouse, and have a surface you can use it on.
In Unity's top menu: Edit->Project Settings->Input
file:///Applications/Unity/Unity.app/Contents/Documentation/html/en/Manual/class-InputManager.html
file:///Applications/Unity/Unity.app/Contents/Documentation/html/en/Manual/ConventionalGameInput.html
In the input Manager you can change settings for each “action”. There is a Positive Button and an Alt Positive button. Both of these can be use independently. "Fire 1” Positive Button is set to "left ctrl”. "Fire 1” Alt Positive Button is set to “mouse 0” <—— left mouse click..... So if you hit the left control key OR use the trackPad/Left-Mouse-Button, this will activate Fire 1. I can not find a way to have multiple buttons in this list. For instance, I can not set "Fire 1” Positive Button to "left ctrl + mouse 0” Can not find any documentation on this.
…anyway … In whatever input script you have for your game, find a line that looks like this:
if (Input.GetMouseButtonDown(1))
And change it to:
if (Input.GetButtonDown(“Fire1"))
This will make it use whatever button you assigned in the inputManager calls the action.
OR….
In that same script, replace the line of code
if (Input.GetMouseButtonDown(1))
with:
if (Input.GetKey("left ctrl") && Input.GetMouseButtonDown(0))
This will make it so you must use the Left Control Click AND the trackPad/Left-Mouse-Button. This will make it so every mac user can continue to use the asset as normal, where Ctrl-click is the same a s Right-MouseButton click.
If you want to get fancy, and tend to use Mac and PC for doing your programing…
if (Input.GetKey("left ctrl") && Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
The || is the same as an OR statement.
Of course, later, when you port over to your mobile device, you’ll have to create those inputs, but that will be later, after you tested your assets, and know what you want your game to do.
Hope this helps.
If anyone knows how to put multiple key combinations in the input manager, please let me know.
Thanks.
Some other good resources for this:
https://blog.safaribooksonline.com/2013/11/26/managing-player-input-in-unity/
http://wiki.unity3d.com/index.php?title=Basic_iOs_Input_Tutorial
http://answers.unity3d.com/questions/553618/how-can-i-use-multiple-getbuttondown-keys-simultan.html
file:///Applications/Unity/Unity.app/Contents/Documentation/html/en/Manual/ConventionalGameInput.html
button values are 0 for left button, 1 for right button, 2 for the middle button. http://docs.unity3d.com/ScriptReference/Input.GetMouseButton.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613160218im_/https://answers.unity.com/themes/thub/images/avi.jpg)