public void SetAllBorderWidth(float width) { for (int i = 0; i < tobogganParts.Length; i++) { ScriptableControlPoints scriptableCP = tobogganParts[i]; scriptableCP.SetAllBorderWidth(width); } }
public void SetAllBorderHeight(float height) { for (int i = 0; i < tobogganParts.Length; i++) { ScriptableControlPoints scriptableCP = tobogganParts[i]; scriptableCP.SetAllBorderHeight(height); } }
public void SaveModel() { ScriptableControlPoints scriptable = ScriptableObject.CreateInstance <ScriptableControlPoints>(); scriptable.ctrlPoints = controlPoints; scriptable.pipesParams = new List <ScriptableControlPoints.PipeParams>(); for (int i = 0; i < transform.childCount; i++) { CustomPipe child = transform.GetChild(i).GetComponent <CustomPipe>(); foreach (MeshCollider meshCollider in child.gameObject.GetComponents <MeshCollider>()) { Destroy(meshCollider); } //gameObject.AddComponent<MeshCollider>(); foreach (MeshCollider meshCollider in child.transform.GetChild(0).GetComponents <MeshCollider>()) { Destroy(meshCollider); } child.transform.GetChild(0).gameObject.AddComponent <MeshCollider>(); //layer obstacle = 9 child.transform.GetChild(0).gameObject.layer = 9; ScriptableControlPoints.PipeParams pipeParams = new ScriptableControlPoints.PipeParams(); pipeParams.bezierPoints = child.bezierPoints.ToArray(); pipeParams.minArchNum = child.minArchNum; pipeParams.maxArchNum = child.maxArchNum; pipeParams.startAngle = child.startAngle; pipeParams.endAngle = child.endAngle; pipeParams.pipeWidth = child.pipeWidth; pipeParams.thickness = child.thickness; pipeParams.borderWidth = child.borderWidth; pipeParams.noBorderLeft = child.noBorderLeft; pipeParams.noBorderRight = child.noBorderRight; pipeParams.shapeIndex = child.shapeIndex; scriptable.pipesParams.Add(pipeParams); } AssetDatabase.CreateAsset(scriptable, "Assets/Scripts/ScriptableObject/scriptableControlPoints_" + Mathf.Round(Time.time * 10000f) + ".asset"); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); EditorUtility.SetDirty(scriptable); }