`enter code here`![alt text][1]
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Dibujar : MonoBehaviour {
// Update is called once per frame
void Update ()
{
if (Input.GetMouseButtonDown(0)) {
StartCoroutine(dibujar());
}
}
IEnumerator dibujar()
{
LineRenderer r = new GameObject ().AddComponent ();
List posiciones = new List();
while (Input.GetMouseButton(0))
{
posiciones.Add(Camera.main.ScreenToWorldPoint(Input.mousePosition));
r.SetVertexCount(posiciones.Count);
r.SetPosition(posiciones.ToArray());
yield return new WaitForSeconds(0);
}
}
}
[1]: /storage/temp/95964-script.png
↧