Question by
Brudri · Jun 15, 2017 at 08:26 AM ·
error messagelinerendererunity 5.2
error CS1501 no overload for method 'SetPosition' takes '1' argument, Unity Version 5.2
enter code here
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<LineRenderer> ();
List<Vector3> posiciones = new List<Vector3>();
while (Input.GetMouseButton(0))
{
posiciones.Add(Camera.main.ScreenToWorldPoint(Input.mousePosition));
r.SetVertexCount(posiciones.Count);
r.SetPosition(posiciones.ToArray());
yield return new WaitForSeconds(0);
}
}
}
script.png
(66.4 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612124224im_/https://answers.unity.com/themes/thub/images/avi.jpg)