I just started using unity and I want to add a single dot to a game object.
I tried using line renderer with a code from online:
void Update()
{
if (Input.GetMouseButtonDown(0)){
CreateDot();
}
}
void CreateDot()
{
currentLine = Instantiate(linePrefab, Vector3.zero, Quaternion.identity);
lineRenderer = currentLine.GetComponent<LineRenderer>();
fingerPositions.Clear();
fingerPositions.Add(Camera.main.ScreenToWorldPoint(Input.mousePosition));
fingerPositions.Add(Camera.main.ScreenToWorldPoint(Input.mousePosition));
lineRenderer.SetPosition(0, fingerPositions[0]);
lineRenderer.SetPosition(1, fingerPositions[1]);
}
This creates a dot but single fixed position.
What I need is to create a dot within bounds of another game object where mouse is clicked.
Thanks for any help.