public static void CreateBranch(Spline spline, int connectionPointIndex, bool isInbound) { Spline branch = SplineEditor.CreateSpline( spline.transform.position, spline.GetThickness(connectionPointIndex), spline.GetTwist(connectionPointIndex), spline.GetControlPointMode(connectionPointIndex), "Battlehub.Spline.CreateBranch"); branch.name = "Branch"; RecordHierarchy(spline, "Battlehub.Spline.CreateBranch"); spline.SetBranch(branch, connectionPointIndex, isInbound); if (isInbound) { branch.AlignWithNextSpline(); Selection.activeGameObject = branch.GetSplineControlPoints().First().gameObject; } else { branch.AlignWithPrevSpline(); Selection.activeGameObject = branch.GetSplineControlPoints().Last().gameObject; } EditorUtility.SetDirty(spline); }
public static void Create() { Camera sceneCam = SceneView.lastActiveSceneView.camera; Thickness thickness = new Thickness(Vector3.one, 0, 1); Twist twist = new Twist(0, 0, 1); Selection.activeGameObject = SplineEditor.CreateSpline(sceneCam.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 5f)), thickness, twist).gameObject; }