Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

HOTween Question - Multiple tweens one object

Discussion in 'Scripting' started by Danz0r77, May 14, 2013.

  1. Danz0r77

    Danz0r77

    Joined:
    Mar 19, 2013
    Posts:
    20
    Hi

    I'm using the HOTween extension in Unity and struggling to get two tweens working on one object.

    I've created the tweens like so:
    Code (csharp):
    1.  
    2. var mySequence = new Sequence(new SequenceParms().Loops(-1,LoopType.Yoyo));
    3.     mySequence.Append(HOTween.To(transform, 1, new TweenParms().Prop("position", new Vector3(0,1,0),true).Ease(EaseType.Linear)));
    4.     mySequence.Append(HOTween.To(transform, 5, new TweenParms().Prop("position", new Vector3(-10,0,0),true).Ease(EaseType.Linear)));
    5.     mySequence.Play();
    6.  
    What I want to have is the object moving up and down with a duration of 1 second, while also moving left and right with a duration of 5 seconds. What actually happens is the object moves up, moves left for 5 seconds, moves right for 5 seconds and finally moves down again.

    How should I be coding this to get it right?
     
  2. cdevl

    cdevl

    Joined:
    Apr 10, 2013
    Posts:
    180
    Try to tween x and y coords separately using separate tweens - no sequence.
     
  3. neroziros

    neroziros

    Joined:
    Aug 25, 2012
    Posts:
    129
    To avoid problems I'd suggest using the two tweens on two different layers (one child of another) that way you will avoid any conflict and get the same result.
     
unityunity