I'm trying to get a list of Vector2 position by tracking my finger and then tracing them with a prefab (Basically just gestures). I have appended an onGUI function to help print out the list of vectors.
However, the attached code does not work and only prints "System.collection.Generic.List'1[UnityEngine.Vector2] when my finger moves along the screen. I know I'm missing something; any help would be greatly appreciated.
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
public class line : MonoBehaviour
{
List<Vector2> movePos = new List<Vector2>();
private float lastFingerRelease;
public String printer;
void Start()
{
}
void Update()
{
if (Input.touchCount > 0)
{
Touch touch = Input.GetTouch(0);
if(touch.phase == TouchPhase.Began && Time.time - lastFingerRelease > 2)
{
printer = movePos.ToString();
movePos.Clear();
}
else if (touch.phase == TouchPhase.Ended)
{
lastFingerRelease = Time.time;
}
movePos.Add(touch.position);
}
}
void OnGUI()
{
GUI.Label(new Rect(0, 0, 1000, 1000), printer);
}
}