private void RenderOutSplinesSoFar(GameObject splineHolder, int i, List <SplineNode> myarray) { GameObject child = new GameObject(); child.transform.parent = splineHolder.transform; SplineMesh.Spline splineScriptObj = child.GetComponent <SplineMesh.Spline>(); // if (splineScriptObj == null) splineScriptObj = splineHolder.transform.parent.GetComponentInChildren<SplineMesh.Spline>(); if (splineScriptObj == null) { splineScriptObj = child.gameObject.AddComponent <SplineMesh.Spline>(); } //finding holder SplineMesh.ExampleSower splineObj = child.GetComponent <SplineMesh.ExampleSower>(); // if (splineObj == null) splineObj = terrain.transform.parent.GetComponentInChildren<SplineMesh.ExampleSower>(); if (splineObj == null) { splineObj = child.gameObject.AddComponent <SplineMesh.ExampleSower>(); } Transform reft; GameObject go; //or creating it if (splineObj == null) { go = new GameObject(); } else { go = child.gameObject; reft = child.gameObject.transform; } go.transform.parent = splineHolder.transform; // TODO make this an actual hash and shove it in a table // string hash = string.Format("{0}_{1}_{4}_{5}|{2}_{3}", startvec.x, startvec.y, startvec.z, endvec.x, endvec.y, endvec.z); // string fullhash = string.Format("{0}_{1}|{4}_{5}|{2}_{3}", startvec.x, startvec.y, startvec.z, endvec.x, endvec.y, endvec.z); string hash = string.Format("__SPLINE__{0}__{2}|{3}__{5}", myarray[0].Position.x, myarray[0].Position.y, myarray[0].Position.z, myarray[myarray.Count - 1].Position.x, myarray[myarray.Count - 1].Position.y, myarray[myarray.Count - 1].Position.z); var newSpline = go; // Extract the stuff we welded in the settings and reweld it to the output newSpline.name = hash + splines[i].chosenType.prefab.name; splineScriptObj.nodes = myarray; newSpline.transform.localPosition = new Vector3(); splineObj.prefab = splines[i].chosenType.prefab; splineObj.isRandomYaw = splines[i].isRandomYaw; splineObj.spacing = splines[i].spacing; splineObj.spacingRange = splines[i].spacingRange; splineObj.offset = splines[i].offset; splineObj.offsetRange = splines[i].offsetRange; splineObj.scale = splines[i].scale; splineObj.scaleRange = splines[i].scaleRange; splineObj.spline.nodes = myarray.ToList(); splineScriptObj.nodes = myarray.ToList(); splineScriptObj.RefreshCurves(); var scrp = newSpline.AddComponent <AlignNodesToTerrainOnEnable>(); splineObj.Sow(); scrp.RunIt(); }