Search Unity

DOTween (HOTween v2), a Unity tween engine

Discussion in 'Assets and Asset Store' started by Demigiant, Aug 5, 2014.

  1. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    Say... Wouldja look at that ! :p
     
  2. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    I'm wondering if maybe the float version of SetLookAt doesn't deal with open paths since there's no "percentage ahead" at the end of an open path??? Should I be using different SetLookAt parameters to get my object to simply align with the path when the path is open (e.g., a S path, or a U path)?
     
  3. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    Thanks FuguFireCracker for the response (although not sure why I can't see it in the forum). I took your suggestion to try the code in a fresh scene and was able to repro the problem. Just drop the script on a long gameobject and you'll see the overrotation at the end of the path. You can play with different numbers but I noted the values I'm having trouble with, which is when the object just comes over the top of a curve
    Code (CSharp):
    1. public class DoPathTest : MonoBehaviour {
    2.  
    3.     public GameObject train;
    4.  
    5.     public Vector2[] testPoints;
    6.  
    7.     private Vector3[] path;
    8.  
    9.     // Use this for initialization
    10.     void Start () {
    11.  
    12.         path = GetFollowPath();
    13.  
    14.         train.transform.DOPath(path, 2f, PathType.CatmullRom, PathMode.TopDown2D).SetEase(Ease.Linear).SetLookAt(0.1f);
    15.     }
    16.  
    17.     private Vector3[] GetFollowPath() {
    18.  
    19.         Vector3[] temp = new Vector3[5];
    20.  
    21.         temp[0] = new Vector3 (testPoints[0].x, testPoints[0].y, 0f);    // (-2, 2.6)
    22.         temp[1] = new Vector3 (testPoints[1].x, testPoints[1].y, 0f);    // (-1.9, 2.9)
    23.         temp[2] = new Vector3 (testPoints[2].x, testPoints[2].y, 0f);    // (-1.6, 3)
    24.         temp[3] = new Vector3 (testPoints[3].x, testPoints[3].y, 0f);    // (-1.5, 3)
    25.         temp[4] = new Vector3 (testPoints[4].x, testPoints[4].y, 0f);    // (-1.4, 3)
    26.  
    27.         return temp;
    28.     }
    29. }
     
  4. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    I think someone may have accidentally deleted my reply. That someone being me -when I was removing an attached image. :confused:

    So... Indeed there does appear to be a glitch in the matrix when passing a float with PathMode.TopdDown2D.

    Try vector3s !

    Code (CSharp):
    1.  
    2. protected void Awake()
    3.     {
    4.         // cache the transform
    5.         _transform = GetComponent<Transform>();
    6.     }
    7.  
    8.     void Start()
    9.     {
    10.         // don't need the private 'path' variable: use the pure function
    11.  
    12.         _transform.DOPath(GetFollowPath(), 10f, PathType.CatmullRom, PathMode.TopDown2D).SetEase(Ease.Linear).SetLookAt(lookAtPosition: Vector3.zero, forwardDirection: Vector3.forward);
    13.     }
    14.  
    15. private Vector3[] GetFollowPath()
    16.     {
    17.         var pathVectors = new Vector3[5];
    18.  
    19.      
    20.         pathVectors[0] = new Vector3(TestPoints[0].x, TestPoints[0].y, 0f); // (-2, 2.6)
    21.         pathVectors[1] = new Vector3(TestPoints[1].x, TestPoints[1].y, 0f); // (-1.9, 2.9)
    22.         pathVectors[2] = new Vector3(TestPoints[2].x, TestPoints[2].y, 0f); // (-1.6, 3)
    23.         pathVectors[3] = new Vector3(TestPoints[3].x, TestPoints[3].y, 0f); // (-1.5, 3)
    24.         pathVectors[4] = new Vector3(TestPoints[4].x, TestPoints[4].y, 0f); // (-1.4, 3)
    25.  
    26.         return pathVectors;
    27.     }
    28.  
     
  5. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    oooh, found a glitch, oh happy day

    I'll experiment with the other SetLookAt types, but the specific example you gave above isn't working for. Did it work for you? As a 2D implementation, picking Vector3.zero as a LookAt target doesn't make sense to me
     
  6. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    Lots of factors here:

    I have no idea where your objects is; what it's pivot / rotation is; if it has that damndable blender -90 rotation on it ( that f*cks everything up); which way is your camera facing... And some other things that could go wonky.

    Here's a package to look at:
    Camera facing straight down the Y axis.
    Model completes 2D path always looking at center of the screen.
    Model is actually facing backwards, so that has been addressed in the code

    And this is how you do it. ;)
     

    Attached Files:

  7. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    That helps, and I understand that every situation needs to be customized. Where I'm strugging is identifying the right target (either transform or Vector 3) for SetLookAt that will orient to path. That target location needs to move throughout the duration of the DoPath. From my experiments, transform & Vector3 targets seem to be fixed at the beginning of DoPath, so the rotation is always towards a fixed target, instead of the point that is next along the path.

    For example, if I make the target _transform.right, the object being moved will always lookat where _transform.right was at the beginning of the DoPath. I need something that's the equivalent of path.right (lookat the forward direction of the current position of the path).
     
  8. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    Oh you gotta be kidding... You didn't mention you wanted to orient your model to the path... You stated that you wanted to look at something...
     

    Attached Files:

  9. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    I only have eyes for the path, which on closer inspection seems to be the cause of the problem. And kudos on the best named unitypackage of all time. I'm attaching a modified version with how I'm using the camera and objects, and with a series of test paths, some of which work and some that "flip out" at the end of the path.

    As you'll see, the problematic paths are ones with tiny distances between waypoints. If you stretch out the waypoints, everything works. But if you shrink that distance, you'll see the "flip out" that I was experiencing in my game
     

    Attached Files:

  10. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    797
    Have you tried playing with the path resolution?
     
  11. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    Yup. What we have here is a reproducible bug owing to the tiny path size and the catmull maths applied to thereto... :|

    Sadly, it has no effect.

    The only think that can be done in your case -if rescaling the world is not an option LOL- is to deal with the side effects with some hacky-hacky...

    Monitoring the transform of the object in motion shows that there is an unceremonious rotation of -90 on the Y at the end of the journey along the path. So... Let's counter that:

    Code (CSharp):
    1.  // Add to the end of the DOPath tweener:
    2. .OnComplete(()=>_transform.localRotation = Quaternion.Euler( new Vector3(_transform.localRotation.eulerAngles.x, 0, transform.localRotation.eulerAngles.z)));
    It's ugly, I know... but it will straighten you right out... ;)

    Edit:
    There is also OnWaypointChange ... in case you need to enforce some rules along the way.
     
    Last edited: Feb 23, 2018
    flashframe likes this.
  12. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    Unceremonious, indeed! Good thing I'm perfectly comfortable with some hacky hacky now that I know what to avoid. I'll try your approach, and I'll also try scrubbing the path points ahead of calling DoPath and omitting the ones that are too close together.

    Thanks so much for all the help figuring it out.:)
     
    FuguFirecracker likes this.
  13. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    If your paths are being generated dynamically: Low Pass Filter !
    You can google "low pass filter c#" to see some implementations.
    Here's a really simple one I had prepared earlier: << Produces Cake from beneath the counter... Zoom in on Cake >>
    Code (CSharp):
    1.    
    2. public static float LowPassFilterCoef { get; set; }    
    3.  
    4.    private static Vector3 LowPassFilter(Vector3 nowVector, Vector3 priorVector)
    5.         {
    6.             var outVector = nowVector;
    7.  
    8.             outVector.x = priorVector.x + LowPassFilterCoef * (nowVector.x - priorVector.x);
    9.             outVector.y = priorVector.y + LowPassFilterCoef * (nowVector.y - priorVector.y);
    10.             outVector.z = priorVector.z + LowPassFilterCoef * (nowVector.z - priorVector.z);
    11.  
    12.             return outVector;
    13.         }
     
  14. jameskanestl

    jameskanestl

    Joined:
    Nov 3, 2017
    Posts:
    12
    Hi, all. Been looking for support but no luck so far. Super weird problem. Using Unity 2017.3.0f3.

    Using DOTween (originally the free version, then bought Pro to try and fix my bug) to do some very simple pathing animations. In one scene, this works fine w/ the following code:

    Code (CSharp):
    1.     void StartPath () {
    2.  
    3.         DOTween.Init();
    4.         player.transform.DOPath (waypoints, 62f, PathType.Linear)
    5.             .SetLookAt (.03f)
    6.             .SetEase (Ease.Linear)
    7.             .OnComplete(StartPauseAfterFinishCoroutine);
    8.         DOTween.Play (player);
    9.     }
    In the very next scene, essentially the exact same code throws this error.

    Assets/Scripts/StudyMatchingController.cs(41,10): error CS1929: Type `UnityEngine.Transform' does not contain a member `DOPath' and the best extension method overload `DG.Tweening.ShortcutExtensions.DOPath(this UnityEngine.Rigidbody, UnityEngine.Vector3[], float, DG.Tweening.PathType, DG.Tweening.PathMode, int, UnityEngine.Color?)' requires an instance of type `UnityEngine.Rigidbody'

    The exact same call to DOPath works in one script, but if added to the second it won't even compile. I've tried deleting the plugin (from the project and the AppData download folder) and reinstalling, same thing every time. Even tried upgrading to Pro (which I'm sure will be worth it once I can figure out this bug). Any help appreciated, thanks all.

    EDIT: fwiw, doing as the error suggests and accessing the player gameObject through its rigidbody component is ineffective and gives a similar error.

    EDIT: ah, okay. Fixed. In the second instance that was causing the error I was feeding DOPath a Transform[] instead of a Vector3[] without realizing it due to similarly named but differently typed variables in each script. I'll leave this posted in case anyone else encounters this error. Cheers!
     
    Last edited: Feb 23, 2018
  15. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    Or they could just read page 56 ;)
     
  16. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    hey @FuguFirecracker suppose @vivredraco wanted to go from _waypoints[0] to _waypoints[3] then to _waypoints[2], and I don't know complete the path to _waypoints[_waypoints.Length - 1]?

    Just curious
     
  17. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    While I do LOVE cake and appreciate you serving up a slice, I don't think this flavor of cake will help in my specific situation. I also wanted to report back on what hacks I've tried, and unfortunately, failed to help.

    The simplest OnComplete() hack of throwing away the unceremonious ending value didn't work since, in my case, it wasn't Y that was changed, it was Z that flipped out. Since that's the key for 2D rotation, I couldn't throw it out, and I couldn't figure out a way to preserve the value prior to the flipout to be able to snap back with OnComplete()

    I failed to use OnWayPointChanged() to preserve the correct final z rotation prior to flipout since that only allows int parameters

    I also tried giving double the number of waypoints in the same space, in case the algorithm needed more data to determine the curve, but that didn't work

    Pruning the list of waypoints that were too close also failed to help. It seems the flipout occurs with a combination of waypoint distance AND curve shape AND perhaps minimum number of waypoints. I wasn't able to observe any pattern in why some sets of waypoints caused the flipout and others did not. But here are some fun pics of my specific situation in case you can get me back on track.

    It's a 2D grid game, each cell is 1 unit square, and the track in each cell is either straight or curved. I use 5 points to define the path in each cell, and then move a gameobject from cell to cell using a combination of waypoints from the adjacent cells, which is what is being fed to DoPath. Some work, some don't. Hair pulling begins.

    If I use even spacing between the waypoints like the first pic, moving from D to H, or from B to F, the gameobject always flips out when it stops. Everything follows the path perfectly until the last frame.

    evenspacing.png

    Now if I change the spacing between the waypoints like so, then moving from D to H is stable, but B to F still flips out. If I remove waypoint E, then B to F still flips out.
    spreadspacing.png

    A couple of additional thoughts/ideas:
    Would the DoPath component in DoTween Pro suffer the same issues? If not, I'd try that
    Is this related to the 620 fix? maybe there's a clue there
    Can you point me to the source code section that contains the catmull code? That could help me figure out why some paths work and others don't

    Thanks again for the help, advice, and ideas.
     
  18. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    The Z, you say !
    Odd that our trial runs would menace the Y, yet it's the Z that flakes out on actual implementation.
    Are you using this on a 3D model or a sprite?
    And if it's a 3D model, does it have that damn blender -90 FBX hack baked in ?
    What can we consider is the difference between the trial model and the production model?
    Therein lies an answer, I suggest. Make sure that unit is zeroed-out and facing the right way when you import it.

    Oh no sir, that's just the delegate signature. You MAY pass the WayPoint index for your convenience. You don't have to perform any calcs on that. We don't need it to make our adjustments .There really should be an override for this, because it is a bit confusing.

    Code (CSharp):
    1.  .OnWaypointChange(KeppOffTheLawn);
    2.  
    3.     private void KeppOffTheLawn(int waypoint)
    4.     {
    5.        // you don't need to do anything with the waypoint parameter
    6.  
    7.        if(_transform.rotation.z > someCondition)
    8.              {
    9.                      // Corrective code here
    10.                     // Good thing we cached the Transform
    11.              }
    12.     }
    Why cant' you use a corrective OnComplete here?

    Here ya go

    If you are able to send me a stripped down package with the actual model (don't need materials or textures ) in the actual circumstances of execution, I can surely take a look at it.

    Failing all that, it might be time to start looking at DOBlendableMove

    http://dotween.demigiant.com/documentation.php
     
  19. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    _waypoints.Length -1 is an expression that evaluates to an int. It is the slap-bang equivalent of using the number 2 , if that was indeed the last index of the array.

    Effectively, you're just doubling up on the last waypoint.

    But try it and see. Report back :)
     
  20. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    Here's a stripped down project. It makes for a fun Conga Line simulation. With the current settings, just the caboose does the Conga. But if you look at the TrainManager in the scene, you can change the angle along the curve so that the waypoints are evenly spaced (e.g., 67.5, 45, 22.5), and you can make both trains Conga. You can see the waypoint spacing in yellow for whatever angles you pick. Enjoy!
     

    Attached Files:

  21. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    My question is rephrased like this, notice the pseudo code to avoid confusion:
    If I wanted to go from _waypoints[0] to _waypoints[3] then to _waypoints[2], and finally to _waypoints[last item of the array]?

    Like the poster asked earlier, how would you go about it? The poster asked about using DOPath but I am really curious if my hypothetical case is even possible?

    It is somethin I am curious about DOTween, moving to intermediate cached points and then move in sequence , like a to b, or a to c?
    I asked before but the DOPath method got me thinking it may be possible.

    thanks
     
  22. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    614
    if i have a gameobject with visual scripting component with AutoKill = off, and i destroy the gameobject. will the tween cache be destroyed as well?
     
  23. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    Code (CSharp):
    1. private readonly float[] _cachedZzzzz = {0, 0};
    2.  
    3.     public void MoveCar(Vector2[] currentPoints, Vector2[] nextPoints, bool outbound, float duration)
    4.     {
    5.        // .........................
    6.  
    7.  
    8.             _transform.DOPath(nextPath, duration, PathType.CatmullRom, PathMode.TopDown2D)
    9.                 .SetEase(mEase)
    10.                 .SetLookAt(0.1f)
    11.                 .OnUpdate(CacheTheZ)
    12.                 .OnComplete(DontFlipOut);
    13.              
    14.     // .................................          
    15.          
    16.     }
    17.  
    18.     private void CacheTheZ()
    19.         {
    20.         _cachedZzzzz[0] = _cachedZzzzz[1];
    21.         _cachedZzzzz[1] = _transform.rotation.eulerAngles.z;
    22.     }
    23.  
    24.         private void DontFlipOut()
    25.     {
    26.             _transform.rotation = Quaternion.Euler(new Vector3(_transform.rotation.eulerAngles.x, _transform.eulerAngles.y, _cachedZzzzz[0]));
    27.     }
    28.                
     

    Attached Files:

    Livealot likes this.
  24. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    DOPath take an array of Vector3s and iterates through that array from 0 to last.
    It does not make allowances to visit waypoints at random nor out of sequence.

    Think about it... If you go from point to point out of turn, you're not really following a path.
    You're just going wherever you please, as long as it's in the tour brochure.

    If you want it to visit the places out of sequence, you need to build a new array to feed to DOPath.
    Or don't bother with DOPath... DOMove is perfectly respectable.
     
  25. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    If a tree falls in the forest ...
     
  26. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    Choo Choo Indeed!!! Thanks so much for your patience and persistence to help me figure out how to fix the flipout glitch
     
  27. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    You're welcome.
    Side note: I noticed that you imported sprites at 256 pix per unit.

    Unity's 2D physics implementation [Box2D] is kinda-sorta based on the notion that your sprites are gonna come in or at around 100 pix per unit. If you got physics in your 2D game, things may not work as expected with vastly different pixels per unity..

    Just a heads up.

    Good luck with it all.
     
    Last edited: Feb 27, 2018
  28. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    I have a memory game and when scene starts, Round screen coming from right to middle of scene and waiting 1 second and going to left but when i pass to round 2, the screen going left from right as speedy. I did not understand. Where do i do wrong?

    Code (CSharp):
    1. void ShowQuestions()
    2.     {
    3.         questionData = questionPool[questionIndex];
    4.         StartCoroutine("RoundShow");
    5.     }
    6.  
    7.  
    8. IEnumerator RoundShow()
    9.     {
    10.         if (roundNumber <= 3)
    11.         {
    12.             roundCount.SetActive(true);
    13.             roundCount.transform.DOMove(new Vector3(3,0,0), 0.5f, false).From();
    14.             roundCount.GetComponentInChildren<Text>().text = "Round " + roundNumber.ToString();
    15.             yield return new WaitForSeconds(1);
    16.             roundCount.transform.DOMove(new Vector3(-3,0,0), 0.5f, false);
    17.             StopCoroutine("RoundShow");
    18.         }
    19.     }
    20.  
    21.  
    22. IEnumerator NextRound()
    23.     {
    24.         yield return new WaitForSeconds(2);
    25.         if (roundNumber <= roundNumber + 1)
    26.         {
    27.             roundNumber++;
    28.             ShowQuestions();
    29.         }
    30.         StopCoroutine("NextRound");
    31.     }
     
  29. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    797
    If I understand the problem correctly, when you tween an object DOTween uses the objects current position as its starting point.

    I think you have to reset the position of roundCount at the end of the second tween.

    Code (CSharp):
    1. void RoundShow()
    2. {
    3.     if (roundNumber <= 3)
    4.     {
    5.         roundCount.SetActive(true);
    6.         roundCount.transform.DOMove(new Vector3(3,0,0), 0.5f, false).From();
    7.         roundCount.GetComponentInChildren<Text>().text = "Round " + roundNumber.ToString();
    8.         yield return new WaitForSeconds(1);
    9.         roundCount.transform.DOMove(new Vector3(-3,0,0), 0.5f, false).OnComplete(()=>{roundCount.SetActive(false); roundCount.transform.position = Vector3.zero;});
    10.         StopCoroutine("RoundShow");
    11.     }
    12. }
    Unrelated, but you could also use a Sequence instead of a coroutine.
     
  30. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    I also recommend not using DoTween inside a CoRoutine.
    You can have DoTween take care of your timings | waitings with a Sequence.
    Code (CSharp):
    1. DOTween.Sequence().AppendInterval(2).OnComplete(DoThisThing);
     
  31. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    does not work
     
  32. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    797
    In that case, I don't think I understood the problem correctly, or the specifics of your setup.
     
  33. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    roundCount will come from right and stop at the middle for 1 sec, then roundCount will go to left. You get it now?
     
  34. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    I didn't understand how do i do it
     
  35. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    Code (CSharp):
    1.    
    2. private const float WAIT_TIME = 1;
    3.  
    4.         void ShowQuestions()
    5.         {
    6.             RoundShow();
    7.         }
    8.  
    9.  
    10.      private void RoundShow()
    11.         {
    12.             if (roundNumber <= 3)
    13.             {
    14.                 roundCount.SetActive(true);
    15.                 roundCount.transform.DOMove(new Vector3(3,0,0), 0.5f, false).From();
    16.                 roundCount.GetComponentInChildren<Text>().text = "Round " + roundNumber.ToString();
    17.        
    18.                 DOTween.Sequence().AppendInterval(WAIT_TIME).OnComplete(() =>
    19.                 {
    20.                     roundCount.transform.DOMove(new Vector3(-3,0,0), 0.5f, false);
    21.                     StopCoroutine("RoundShow");
    22.                 });
    23.            
    24.             }
    25.         }
    26.  
    27.  
    28.         private void  NextRound()
    29.         {
    30.             DOTween.Sequence().AppendInterval(WAIT_TIME * 2).OnComplete(() =>
    31.                 {
    32.                     if (roundNumber <= roundNumber + 1)
    33.                     {
    34.                         roundNumber++;
    35.                         ShowQuestions();
    36.                     }
    37.                 }
    38.             );
    39.         }
    I didn't try to fix any other code issues you may be having...

    Also unrelated... But your Methods should not start with an IF
    That IF should be decided somewhere else and then choose the appropriate method to execute. It makes no sense to start a coroutine just to check if something is true.
     
    flashframe likes this.
  36. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    797
    Oh, if you copy and pasted my code exactly, then it won't work, since I forgot that your original method was a coroutine.

    Code (CSharp):
    1. IENumerator RoundShow()
    2. {
    3.     if (roundNumber <= 3)
    4.     {
    5.         roundCount.SetActive(true);
    6.         roundCount.transform.DOMove(new Vector3(3,0,0), 0.5f, false).From();
    7.         roundCount.GetComponentInChildren<Text>().text = "Round " + roundNumber.ToString();
    8.         yield return new WaitForSeconds(1);
    9.         roundCount.transform.DOMove(new Vector3(-3,0,0), 0.5f, false).OnComplete(()=>{roundCount.SetActive(false); roundCount.transform.position = Vector3.zero;});
    10.         StopCoroutine("RoundShow");
    11.     }
    12. }
    Is that what you meant by "does not work"? If not, need a bit more detail. And I agree with @FuguFirecracker that moving it all into a Sequence is a good idea.
     
  37. zyzyx

    zyzyx

    Joined:
    Jul 9, 2012
    Posts:
    227
    You can also try something like this (example):
    Code (CSharp):
    1.  
    2. void ShowQuestions()
    3. {
    4.     questionData = questionPool[questionIndex];
    5.  
    6.     if(roundNumber <= 3)
    7.     {
    8.         roundCount.SetActive(true);
    9.         roundCount.GetComponentInChildren<Text>().text = "Round " + roundNumber.ToString();
    10.  
    11.         var pos = roundCount.transform.position;
    12.         var seq = DOTween.Sequence();
    13.         seq.Append(roundCount.transform.DOMove(new Vector3(3, 0, 0), 0.5f).From())
    14.             .AppendInterval(1)
    15.             .Append(roundCount.transform.DOMove(new Vector3(-3, 0, 0), 0.5f))
    16.             .OnComplete(() => { roundCount.transform.position = pos; roundCount.SetActive(false); });
    17.     }
    18. }
    19.  
     
    Last edited: Mar 2, 2018
  38. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    same issue again. it's working at first round but at second round, roundCount going to left from right, not stopping at the middle
     
  39. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    didn't work at second or third round. it only works at first round. I mean it works while only scene starts
     
  40. TheBooBear

    TheBooBear

    Joined:
    Dec 15, 2011
    Posts:
    95
    Is there a way to design a path tween in the editor and then apply it to a gameobject? Even switch them out at times?
     
  41. Abedron

    Abedron

    Joined:
    May 24, 2017
    Posts:
    5
    After using the two tweens in Sequence I got peaks (10000 iterations). Can they be eliminated?
    https://prnt.sc/ing9uj
     
  42. TheBooBear

    TheBooBear

    Joined:
    Dec 15, 2011
    Posts:
    95

    Figured it out. Liking this asset a lot.
     
  43. IndieGeek

    IndieGeek

    Joined:
    Sep 30, 2016
    Posts:
    16
    Is it working on Unity 2017.3?
     
  44. TheBooBear

    TheBooBear

    Joined:
    Dec 15, 2011
    Posts:
    95
    Are you asking if DotTween is working in 2017.3, then yes.
     
    IndieGeek likes this.
  45. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    Is there a way to have a looping path start it at a specific waypoint index other than 0?
     
  46. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    Code (CSharp):
    1. myPathTween.GotoWaypoint(2);
     
    ParadoxSolutions likes this.
  47. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    I have an ios project that was building fine in XCode with the free version of DOTween, after having updated to DOTween Pro I'm getting a ton of Linker errors in XCode related to DOTween Pro when trying to build.

    Does anyone have any idea of how I can resolve these errors?

    Also, I have DOTween Path components on objects that I instantiate but the objects path isn't relative to where the object spawned, it keeps the points from where the prefab was originally created. I have the "Local Movement" and "Relative" checkboxes selected. How can I have my path waypoints be relative to an objects spawning location?
     
    Last edited: Mar 13, 2018
  48. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    Did you delete the previous version of DoTween before importing the Pro package?
    Did you remember to Setup DoTween Pro ?
    If you did... Try an empty project. Import only DoTween Pro. Are you getting the errors?
    What do the errors say?

    Can you not feed the path a Vector3[] with the adjusted coordinates upon instantiation?
    Disclaimer: I have never used the Pro version.
     
  49. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    @FuguFirecracker

    Thanks for the response

    I did do a clean install of Dotween Pro.
    I'm getting a boat load of errors of this type:
    I don't understand DLLs super well, but does this mean the DLL's in DOTween Pro don't support the ARM64 architecture perhaps?
     
  50. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    I think more than likely it's something not set correctly in XCode.

    if you GOOGLE Undefined symbols for architecture arm64 Unity you'll see quite a few hits.

    Sorry, I can't help you hunt it down. No Mac in sight.