Demigiant Forum

Unity Assets => DOTween & DOTween Pro => Topic started by: abe on July 30, 2015, 08:03:55 PM

Title: Add Dotween path programmatically
Post by: abe on July 30, 2015, 08:03:55 PM
Hello i tried to add DOTweenPath component programmatically but it does not work . Here is my code
var oldPath = GetComponent<DOTweenPath> ();

      var newPath = (DOTweenPath)newObject.AddComponent <DOTweenPath>();

      //tween options
      newPath.autoKill = oldPath.autoKill;
      newPath.autoPlay = oldPath.autoPlay;
      newPath.duration = oldPath.duration;
      newPath.delay = oldPath.delay;
      newPath.easeType = oldPath.easeType;
      newPath.easeCurve = oldPath.easeCurve;
      newPath.loops = oldPath.loops;
      newPath.loopType = oldPath.loopType;

      //path options
      newPath.pathType = oldPath.pathType;
      newPath.pathResolution = oldPath.pathResolution;
      newPath.isLocal = oldPath.isLocal;
      newPath.isClosedPath = oldPath.isClosedPath;
      newPath.orientType = oldPath.orientType;
      newPath.lookAhead = oldPath.lookAhead;

      //waypointes
      newPath.fullWps = oldPath.fullWps;
      newPath.wps = oldPath.wps;
      newPath.wpsDropdown = oldPath.wpsDropdown;



      newPath.DOPlay (); //nothing happens
      oldPath.DOPlay (); // it works
Title: Re: Add Dotween path programmatically
Post by: Daniele on August 04, 2015, 06:04:07 PM
Hi,


I'm afraid the DOTweenPath component is not made to be added programmatically. But in that case you can directly use the DOPath (http://dotween.demigiant.com/documentation.php?api=DOPath) API.