I wonder if there is a way to get the positions of nodes in a line renderer. In the project I'm working on I have a PseudoLine
game object on which I have a line renderer. When I draw a line, I clone PseudoLine
to create a new line. Using simply:
Instantiate(gameObject);
What I want to do is create new gameobjects with a prefab, which also has a line renderer on it. I want to copy the positions of PseudoLine
to my new game object's line renderer. Something like this:
GameObject tempLine = Instantiate(line);
tempLine.GetComponent<LineRenderer>().SetPositions(transform.gameObject.GetComponent<LineRenderer>().Positions);
I checked the documentation and couldn't find any helpful built-in functions. How can I resolve this problem?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…