is it possible to create a new game object and assign it a copy of a line renderer?
here is the situation:
i have a scene with a game object in the center and everytime the user tap that object, a line is drawn from the user’s position to the game object.
What i want to do is to save a copy of each line and try to render them all in the end. I keep on getting lost on the procedure.
what i do is :
create a new gameobject
add the line renderer component
(how can i set the coordinates of this new linerenderer = linerenderer onTap)??
Why don’t you just instantiate a prefab?
On each tap you can just call
LineRenderer newLine = Instantiate(lineRendererPrefab); and assign the correct parameters. On a new tap you deactivate the last LineRenderer, but store it in a List (because you want to show them all in the end, right?).
Does this make sense?
I had ad idea: i just create a new gameobject that has the same position as the linderer is attached to. add every new object to the list and then hide it.
then i iterate the list and active all the hidden objects
stupid but serves my purpose.
Any better idea is accepted