Just Wondering but is there any way to add a gameObject as a point on a Line Render.
For example, I have a grappling hook and when I press A, the line draws out with a hook object attached to the endpoint.
Just Wondering but is there any way to add a gameObject as a point on a Line Render.
For example, I have a grappling hook and when I press A, the line draws out with a hook object attached to the endpoint.
You can get the LineRenderer component and set the points like this:
LineRenderer lr = GetComponent<LineRenderer>();
List<Vector3> points = new List<Vector3>();
points.Add(new Vector3(0, 0, 0));
points.Add(transform.position);
lr.SetPositions(points.ToArray());
You can set the vector3 array to the LineRenderer component, so you can use the game object’s position.
Hope this can help you.