Search Unity

DOTween & SetBlendableScaleBy tweens that get kiiled

Discussion in 'Assets and Asset Store' started by MeeWowGames, Aug 5, 2017.

  1. MeeWowGames

    MeeWowGames

    Joined:
    Dec 22, 2016
    Posts:
    6
    Hi! I have a transform and its localScale gets modified in two places. By default, it's (1,1,1) (let's just call that "1" for simplicity). I'd like the two places that modify its scale to "play nicely" meaning if one of them wants to set it to 2 and the other tries to set it to 3, it should end up at 6.

    This works nicely, but the complication is that sometimes those tweens can be killed and then I don't know what to reset the scale back to.

    If one place in the code did:
    Code (csharp):
    1. Vector3 scaleVector = new Vector3(.1f, .1f, 0f);
    2. transform.DOBlendableScaleBy(scaleVector, 1f)); // Make it a little bigger
    Then in order to reset the scale I could just call:
    Code (csharp):
    1. transform.DOBlendableScaleBy(-scaleVector, 1f)); // Reset the size, scaleVector is negative here
    But if that first tween gets killed part way through (let's say it's only modified the scale by .07f), how do I then reset the scale? I can't necessarily just set it back to 1 because there's potentially another thing setting the scale too, so I'd just like to undo the scale change caused by that first tween. Is there a way to determine how much that tween actually modified the scale of the transform at the moment it got killed so I can negate it? Is there a way to get that value of .07f (in this example) back out of the tween?

    Thank you!
     
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi, while I'm not the right guy to answer your question -

    usually, each asset on the Unity Asset Store has its own thread in the forums, so there should be no need to create your own thread. For DOTween it's this one. You should try your luck there, or contact the developer directly.

    Threads in this section get buried very fast so reaching out in the appropriate channels is more efficient.
     
    MeeWowGames and theANMATOR2b like this.