- Home /
New solution found.
Touch input results not shown in console
I obtained this from the udemy website. All you need is: 1 - Camera - this is the built-in tool you are given. 2 - Just add an empty object, call it touchtest. 3 - Add a script as below:
But I cannot get the coordinates as shown in the tutorial. Instructor was using 2018.x version. All my other projects are working well so I'm wondering if this has been disabled or hidden somewhere in 2019.2.0. See the screenshot to understand what the tutorial has done.! The number of touches are also not detected.alt text
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TouchTest : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.touchCount > 0)
{
//Debug.Log(Input.GetTouch(0).position);
foreach(Touch touch in Input.touches)
{
Debug.Log(touch.position);
}
}
}
}
Are you trying to get touches in the editor? Touches in the editor won't happen, we generally just simulate it with the mouse button if we need to test it in editor.
Why are you referring to the editor when I showed the player mode? The mouse didn't work when I tested it. The instructor didn't use the mouse. If he did, i could have seen it.
The editor.. meaning Unity. You cannot get touch input running the app through Unity (editor). Did they mention using Unity Remote? Then you can probably get touch input via the editor.
If mouse input also did not work you are missing an EventSystem, also make sure you have the standardinputmodule
I think i need to check the tutorials. Unless you have time to put hints here. So far, only unity tutorialsl works but i haven't learnt adb yet.
Probably too late for the original requestor, but maybe someone else is looking for an answer. Try to append '.ToString()' to your data to display them as text.
https://docs.microsoft.com/en-us/dotnet/api/system.object.tostring?view=net-5.0
Follow this Question
Related Questions
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
Mobile input is not working ... 1 Answer
User input display 1 Answer
UnityAds - Ads not showing 0 Answers