1
DOTween & DOTween Pro / [RESOLVED] Programmatically adding waypoints to visual editor
« on: October 26, 2015, 12:40:28 AM »
I'd like to simulate planets orbiting a sun, but catmull rom paths make it rather hard to create a decent-looking circle and I don't want to manually input 100+ points to create a circle. Is there a way to set up the waypoints for the visual editor in code (as an editor script?) to be a "perfect" circle, and then use the visual editor to tweak it a little if necessary (to deform the circle)? Or can I only create a "perfect" circle using the API (and not visible in the editor)?
Edit:
Here's how I got it to work. There doesn't seem to be any documentation on the website, so I figured it out thanks to intellisense and created an editor/inspector script that adds and modifies the DOTweenPath component:
Edit:
Here's how I got it to work. There doesn't seem to be any documentation on the website, so I figured it out thanks to intellisense and created an editor/inspector script that adds and modifies the DOTweenPath component:
Code: [Select]
public override void OnInspectorGUI() {
MyCustomScript t = (MyCustomScript)target;
var path = t.gameObject.GetComponent<DG.Tweening.DOTweenPath>();
if (path == null) {
path = t.gameObject.AddComponent<DG.Tweening.DOTweenPath>();
}
path.wps.Add(Vector3.up);
path.wps.Add(Vector3.zero);
}