private void createAssignNewTailPart() { // if it's the first create, there wont be any thing to push; if (currTailPart) { tailsPartList.Add(currTailPart); } GameObject newTailPart = (GameObject)Instantiate(TailPartPrefab); newTailPart.name = "TailPart" + tailsPartList.Count.ToString(); newTailPart.transform.parent = this.transform.parent; // make the color alittle bit newTailPart.GetComponent <LineRenderer>().material.color = myColor; currTailPart = newTailPart.GetComponent <TailPart>(); // Set the first point currTailPart.setPoint(followMe.position); }
void setPoint() { lastPoint = followMe.position; currTailPart.setPoint(lastPoint); }