public void Create() { Clear(); if (bezierPathDrawer == null) { return; } // draw BezierPath path = bezierPathDrawer.GetBezierPath(); pathLength = path.length; split = (pathLength / distance); float delta = 1.0f / split; for (int i = 0; i < split; i++) { float v = delta * i; BezierPointInfo pInfo = path.GetBezierPointInfo(v); // Hoop gObj = GameObject.Instantiate<Hoop>(hoopPrefab); GameObject gObj = ((GameObject)PrefabUtility.InstantiatePrefab(hoopPrefab)); gObj.transform.SetParent(hoopCourse.transform); gObj.transform.position = pInfo.point; gObj.transform.rotation = pInfo.rotation; gObj.gameObject.name = "Prot_" + i; } }
// Use this for initialization void Start() { target = this.transform; if (bezierPathDrawer != null) { path = bezierPathDrawer.GetBezierPath(); } }