*

abe

  • ***
  • 11
    • View Profile
Add Dotween path programmatically
« 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
« Last Edit: July 31, 2015, 10:31:11 AM by abe »

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Add Dotween path programmatically
« Reply #1 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 API.