3
votes
Accepted
Pressing two buttons on Android with same thumb touch. UI Event Triggers not working
I faced the same issue and found some other solution that could solve it, so probably it will be helpful for someone.
Used unity version: 2022.2.
First of all, I need to say that I’m using input ...
2
votes
How do I tell the difference between tapping and holding the touchscreen?
Why not use touch phase that is built into unity via the Touch class?
...
2
votes
Accepted
How to move my cube left or right using touch Inputs (C#) in unity
Here is an example script to answer your question:
...
2
votes
Accepted
Chain cutting swipe input skips over chains
You are currently experiencing a form of tunnelling. You are checking if touch coordinates move through the Collider's boundaries inwards (outside-inside) or ...
2
votes
Unable to destroy collider Unity3d
I assume that col1 is also declared elsewhere in the code, otherwise I don't understand how this would've compiled.
Notice this line:
...
2
votes
How to know if an actor is touched in libgdx?
Add a Listener to the actor like so. Note you need an InputMultiplexer so your Stage and Screen can both handle touches. Add the Stage first so it gets clicks first, then in the Listener call event....
1
vote
Climbing only works with ApplyRootMotion, but this interferes with swiping to jump or slide
The issue was related to ground check.
In my script, SwipeUp can make Player jump only when it's grounded. I don't know how but ApplyRootMotion makes my character not fully interact with ground. I ...
1
vote
Accepted
1
vote
Accepted
How to make a horizontal scrolling menu in Game Maker Studio 1.4?
Assuming you're using the Device Input functions, finding out if the user is swiping left or right shouldn't be much hard.
In the documentation, about the function ...
1
vote
How do I set something when 2 or more touches are pressed?
The solution for this problem is by inserting this code in the touchmove function
if(Input.touchCount >= 2){
SetVelocityZero();
}
Thank you DMGregory for ...
1
vote
TouchPanel.GetState() Returns wrong touch locations XNA
Okay, well your transformation code is very strange. It looks like you're trying to transform the position of the button rather than the position of the mouse or touch coordinates.
The way you need ...
1
vote
Accepted
How to detect long press on object using Unity EnhancedTouch?
A couple of notes: Unless you specifically want to check that the user keeps their finger on the desired object at all times, I would probably only check at the beginning of the touch, as well as the ...
1
vote
Accepted
How to check if finger is touching the screen using the Unity input system?
One way is to access the InputSystem more directly.
You might be looking for TouchPhase or use the Finger combined with the ...
1
vote
How to make the character move along the axis using touch?
Try multiplying your offset by your aspect ratio: Screen.width / Screen.height.
...
1
vote
Touch control pan 3D map
I believe what you're looking for is what I refer to as "Google Maps" style panning. This is where the pointer stays perfectly locked on the exact place in the world where you started the ...
1
vote
How to get the fingerID (Touch) that is pressing a specific UI button. (Unity)
Shortly after, I figured the problem was that I was not implementing the IPointerDownHandler interface causing the IPointerUpHandler to not work.
And this is the final script:
...
1
vote
Touch input not working well for mobile game made with Unity 2D
Your main problem is that you're checking for input in FixedUpdate.
FixedUpdate is not guaranteed to run every frame, or only ...
1
vote
Jump when the screen is tapped, rather than when the space key is pressed
I changed the code to the following by adding a TouchPhase.Began to the if statement:
...
1
vote
Accepted
In Android, neat way to send input info from `GLSurfaceView` to `onDrawFrame` in `GLSurfaceView.Renderer`?
General Architecture
If you had input and rendering share a thread, that would allow you to mix input and output(rendering) code, making it easier to make messy code.
What I suggest you to do is to ...
1
vote
Rotate a 2D object slowly to the touch position in Unity
Waited more than I expected. I found a simple solution for this.
...
1
vote
Quaternion.slerps resets camera rotation to (0,0,0) when i go to play mode help!
Thanks @DMGregory for pointing this out.
Fixed it by initializing xAxisRotation and yAxisRotation variables to camera's start rotations and by changing the target rotation.
Initialized those at ...
1
vote
Pressing two buttons on Android with same thumb touch. UI Event Triggers not working
You probably want Rect.Overlap()
It allows you to check if one rect overlaps another rect.
So you would want to have a rect for the players touch.
Which you can crate using the position and radius ...
1
vote
How to code dragging of objects in 3d space in Unity (Android/ iOS)?
OK i actually found the solution. I had to use the hit.point variable. Then it was easy:
...
1
vote
Accepted
How to enable CrossPlatformInput in Unity?
What is "a menu item" and where do I find it in the Unity UI?
You know what the File and Edit menus are and where to find those, yes? The package contains an Editor script which adds a new menu item, ...
1
vote
Touch a specific area on the screen in Unity 5
you're on the right way.
now you should create a class that will listen to any clicks on the roulette table, and in the update function of that class you should get the location of the click (either ...
1
vote
Accepted
Android: How to prevent player(drag/drop touch input) from moving through non-moving objects?
Consider using a swept collision test instead of just an intersect/overlap test.
When doing a swept test, the area traveled is also considered for the collision test, not just the final position/...
1
vote
(Unity 5) Weird Touch Behavior
Try changing your state integer into a state boolean, as below.
[Edit] I added the block to make sure the touch count is greater than zero. All sample code I read does this.
Also, your speed in ...
1
vote
Accepted
How to only detect Actor and not background
It the click-handler for the background, make sure you filter out the InputEvents that are already handled:
...
1
vote
Unity2D - move rigidbody object with collision
This is called arrival. It's a steering behavior. The basic concept is:
Apply an acceleration towards the target position (alternatively, you can simply set the velocity if you're not using ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
touch × 183unity × 82
android × 50
c# × 32
input × 28
libgdx × 26
java × 14
mobile × 13
multitouch × 13
2d × 12
movement × 12
control × 10
ios × 9
xna × 7
cocos2d-iphone × 7
monogame × 6
gestures × 6
collision-detection × 5
physics × 5
game-design × 5
rotation × 5
xna-4.0 × 5
events × 5
3d × 4
mathematics × 4