|
I get the answer about how to attach the prefabs to a Empty gameObject,just set the transfom.parent of the prefabs to the transform of Empty gameObject and then I want to create the LineRenderer Object with the script: line:LineRenderer=new LineRenderer(); and the I try to attach this object to the Empty gameObject with script: line.transform.parent=gameObject.tranform but its failed,and then I try to line = gameObject.AddComponent(LineRenderer); but its also fail to draw the line with two vector3 Object I wish to get the solution with this question,how to attach the LineRenderer to an EmptyObject and then draw a line with two vector3 object thanks a lot !
(comments are locked)
|
|
No, you aren't doing this right. This is completely wrong:
You want to do:
You also need to set up the line renderer's vertices and positions using SetVertexCount() and SetPosition(). Make sure you read this page in full: http://unity3d.com/support/documentation/ScriptReference/LineRenderer.html
(comments are locked)
|
