Input falsely recognized on a Samsung Galaxy Tab A7
Hi, I am working on a project to connect multiple tablets together. I programmed a little chess game where I synchronize any Input (done with InputActionAsset and a Click Action with Press[Pointer] binding) over the devices.
When I click on a chess square it invokes an event which is then sent to all devices and the square is selected. All of this worked in unity (also when using multiple instances of unity) and on my smartphone (which is a Xiaomi A1).
public void OnClick(InputAction.CallbackContext context)
{
if (context.performed)
{
Vector2 mousePosScreen = Pointer.current.position.ReadValue();
Vector3 mousePosWorld = cam.ScreenToWorldPoint(new Vector3(mousePosScreen.x, mousePosScreen.y, 99));
Vector2Int newBoardPos = BoardPosition.convertToBoardPosition(mousePosWorld);
// Invokes applySquareSelection on each connected device
ChessEventCollection.POINTER_CLICK.Invoke(new BEHandle<Vector2Int>(newBoardPos), BEventReplicationType.TO_ALL);
}
}
private void applySquareSelection(BEHandle<Vector2Int> newSelectionPos)
{
//Edit: I had this log only in the else clause so it did not put it to the console when the tap was
//recognized a second time
Debug.Log($"Clickevent invoked on {BEventManager.Instance.LocalNetworkID}, clicked on {newSelectionPos.Arg1}");
if(isSquareSelected && (newSelectionPos.Arg1 == currentSelectionPos))
{
deselectSquare();
}
else
{
currentSelectionPos = newSelectionPos.Arg1;
selectSquare();
}
}
Now I purchased a Samsung Galaxy Tab A7 and build it there. When I try to tap on a square it highlights it but instantly deselects again. I tried using Debug.Log in the invoked method to see if it may be invoked multiple times but I only get one message per click on the console.
Are there any problems with this device at the moment, as far as I know, it was released in 2020 so it is rather new. Maybe that could cause some problems? I am using Unity 2020.1.10f1 by the way.
I am pretty clueless about what the problem could be and how I can solve this. I hope anyone can help me out here. Thanks!
Edit: It seems it actually does recognize the tap on the screen two times. So it selects and deselects the square no matter if I tap only momentarily or over a period of time. That only happens on the Galaxy Tab A7 though.
Your answer
Follow this Question
Related Questions
Unity (builds and editor) Keep firing input on its own after Windows 10 update 0 Answers
Mobile Touch vs PC Touch 0 Answers
Unable to change scene in unity,Shows Black Screen 1 Answer
Can't build apk getting error 0 Answers
Building to android fail- unable to convert classes into dex format. 2 Answers