Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

HOTween: a fast and powerful Unity tween engine

Discussion in 'Assets and Asset Store' started by Demigiant, Jan 7, 2012.

  1. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Ok, made the example: you can get it here :)

    It's a Unity Package (which doesn't contain HOTween DLL, so you'll have to either import it in your existing project, or add HOTween by yourself), which shows how to do what you intended. If you have any doubts do ask me again :)

    P.S. The main problem in the example I posted was the Reverse(). Reverse actually inverts the tween direction, meaning if it's going forward it will then go backwards, and viceversa. So a check to see if we need to Reverse it was needed.
     
    Last edited: Mar 20, 2012
  2. mydingefnysen

    mydingefnysen

    Joined:
    Dec 15, 2011
    Posts:
    51
    Oh, thanks a lot! Ill try it out right away!

    Later:
    Ok, I have implemented your code in my project now and its working pretty well. One problem though, is that it works really good with a toggle button like that, but in my code I cant garantee the order in which FadeIn() and FadeOut() gets called, and sometimes they might even be called twice in a row.

    Mostly I think its a problem with my code, but if I call FadeIn() and FadeOut() during the same frame, OnTweenUpdate() is never called and nothing happends.

    Anyways, thanks for your help! Ill try some more stuff and report back later on!
     
    Last edited: Mar 20, 2012
  3. mydingefnysen

    mydingefnysen

    Joined:
    Dec 15, 2011
    Posts:
    51
    Been trying this some more now and cant really get it to work the way I want. If I reverse and play a tween when it is already at the beginning, nothing will happend and OnTweenUpdate will never be called, forcing me to manually call that function. Is there a better solution for that? Heres a shortened version of the code:

    Code (csharp):
    1.  
    2. Tweener tween;
    3. public float alphaValue = 0;
    4. bool isVisible = false;
    5.  
    6. void Start(){
    7. tween = HOTween.To( this, 1,
    8.             new TweenParms()
    9.             .Prop( "alphaValue", 1 )
    10.             .Pause() // Start in paused state (since it will be activated by a button)
    11.             .AutoKill( false ) // Prevent the tween to be killed at completion, so we can re-use it
    12.             .OnUpdate( OnTweenUpdate )
    13.         );
    14. }
    15.  
    16. override public void OnVisible(){
    17.         if ( tween.isReversed ) { tween.Reverse(); }
    18.         else tween.Play();
    19.         if (alphaValue == 1) OnTweenUpdate();
    20.     }
    21.  
    22.     override public void OnInvisible(){
    23.         if ( !tween.isReversed ) { tween.Reverse();}
    24.         else tween.Play();
    25.         if (alphaValue == 0) OnTweenUpdate();
    26.     }
    27.  
    28. private void OnTweenUpdate(){
    29.    Debug.Log("Updating tween...");
    30. }
    31.  
    Another question, is it possible to change tweens parms after it has started? Say I want to change the end value of a prop after it has started to play? Say I want different object to end up at different on/off alpha values (or positions or something else). Or do I need to create a new tween then and killing the one before that?

    Basically what I want to achieve is a way to play a tween forward and backwards and interrupting it any time to change direction, and be resilient to multiple calls of the same type (say, play > play > reverse), and at the same time have control over the start and end values it tweens to.
     
  4. racocvr

    racocvr

    Joined:
    Dec 9, 2011
    Posts:
    9
    Hi Izitmee,

    First, I'll like to thank you for your great work. I to I'm used to AS3 tweeners and I feel a lot more comfortable with your approach than iTween.

    Now the problem I'm facing is that I'm trying to fade a sprite's alpha value. Changing its color requires a call to a function and it's not possible by just editing the property itself (at least as far as I know). So I'm wondering if it's possible to have a plugin that works on methods instead of properties. Something like:
    Code (csharp):
    1. HOTween.To( myGameObject, 1, new TweenParms().Method("methodName", new PlugMethodValues(startValue,endValue)));
    Or maybe adding a callback event fired on each frame. That would do it to.

    ** Update: Oops!! I just realized that OnUpdate callback is exactly what I was asking for. :)
     
    Last edited: Mar 21, 2012
  5. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @mydingefnysen: going to make another sample to post :)

    @racocvr: glad you're liking it :) Apart the OnUpdate callback, what type of sprite are you trying to animate? You can animate an alpha by animating a color's value to the same color with a different alpha, or you can use PlugSetColor if you need access to a different "color" than the default one (like _SpecColor or _Emission).
     
  6. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @mydingefnysen: Ok, here is the same example from yesterday, but with more buttons (like buttons that apply a fadeIn and then a fadeOut in the same frame). Everything seems to work for me, and I'm not sure where is your issue (sorry, my fever went up instead than down, and I'm still dizzy :p).
    About OnUpdate not being called when you reverse the tween and it's already at the beginning, that's an intentional behaviour: since nothing actually changes, OnUpdate doesn't have to be called. If you want to check the tween's position, and eventually call a function if it was already rewinded, you can use:
    Code (csharp):
    1.  
    2. if ( tween.elapsed == 0 ) // Do something.
    3.  
    In the same way, you can check if it's already complete:
    Code (csharp):
    1.  
    2. if ( tween.isComplete ) // Do something.
    3.  
    Or you can check if it ever started at all, with hasStarted (which returns TRUE after a tween was started for the first time, even if it's currently paused, and FALSE if it was never started at all):
    Code (csharp):
    1.  
    2. if ( !tween.hasStarted ) // Tween has never started, do something
    3.  
    About changing end/start values after a tween has been set, it currently can't be done, and you have to re-create a tween each time. I'm planning to implement it sooner or later, but it's one of those things that take ages to be done correctly (since I'd want the tween to re-adapt smoothly to the changes), so I have no idea when I'll actually get to it.
    The only values you can change while a tween is running, as of now, are the Tweener properties (ease, loop properties, timeScale, etc.).
     
    Last edited: Mar 21, 2012
  7. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Sorry for uber-posting, but...

    New Update HOTween v0.8.141.
    - Added renameInstanceToCountTweens parameter to HOTween.Init() (it allows you to choose if you want HOTween's gameObject, while in the Editor, to be renamed to show currently running tweens).
    - Added PlayForward and PlayBackwards methods to HOTween, IHOTweenComponent, ABSTweenComponent, Tweener and Sequence.

    @mydingefnysen: you can use PlayForward and PlayBackwards to avoid checking if you should reverse or re-reverse the tween. Like, instead of:
    Code (csharp):
    1.  
    2. // Play forward
    3. if ( tween.isReversed )  Reverse();
    4. Play();
    5.  
    You can simply use:
    Code (csharp):
    1.  
    2. // Play forward
    3. PlayForward();
    4.  
    (and the same goes for PlayBackwards :))
     
    Last edited: Mar 21, 2012
  8. racocvr

    racocvr

    Joined:
    Dec 9, 2011
    Posts:
    9
    I'm using a PackedSprite from the SpriteManager plugin which shares a material between multiple sprites and that's why it requires a call to SetColor() to adjust the color. Internally, I think it applies the new color to the affected vertices, so the PlugSetColor won't work. But the OnUpdate callback works great!
     
  9. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Oh now I understand :) Then I suppose OnUpdate is really the only solution. Personally, I'm a big fan of 2D Toolkit (using it right now for an Android/iOS game), and with that, to change a sprite color, you just set sprite.color = myColor, so it can be easily animated.
     
  10. mydingefnysen

    mydingefnysen

    Joined:
    Dec 15, 2011
    Posts:
    51
    Great! Thanks for the update, was about to suggest something like that :) Got everything to work now!

    Some more questions for your fevery head: Can OnPlay be used somehow with PlayForward() or PlayBackwards? Is there some nice way to get something like OnPlayForwardComplete or OnPlayForwardComplete? OnComplete only gets called on PlayForward as it is right now if Im not misstaken?

    Anyways, youre doing a great job! Thanks for helping out even though your ill!

    Edit:
    So, this is how I handle that at the moment:
    Code (csharp):
    1.  
    2.     private void OnTweenUpdate()
    3.     {
    4.         if (tween.isReversed)
    5.         {
    6.             if (!isVisible)
    7.             {
    8.                 Debug.Log("STARTING MOVING IN!");
    9.                 isVisible = true;
    10.             }
    11.             if (tween.elapsed == 0)
    12.             {
    13.                 Debug.Log("FINISHED MOVING IN!");
    14.             }
    15.         }
    16.         else
    17.         {
    18.             if (isVisible)
    19.             {
    20.                 Debug.Log("STARTING MOVING OUT!");
    21.                 isVisible = false;
    22.             }
    23.             if (tween.elapsed == tweenTime)
    24.             {
    25.                 Debug.Log("FINISHED MOVING OUT!");
    26.             }
    27.         }
    28.     }
    29.  
     
    Last edited: Mar 21, 2012
  11. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Sure, OnPlay works both with PlayForward than with PlayBackwards (though it is dispatched only if you call one of those methods while the tween is in a paused state).

    In HOTween's architecture, OnPlayBackwards/ForwardComplete wouldn't make much sense, because HOTween actually doesn't know if it's running backwards because you called Reverse or because you called OnPlayBackwards, and I don't want to add a kind of unnecessary overhead to keep track of it. But! I will see tomorrow if I can add an OnRewinded. This way, you could use OnComplete to know when OnPlayForward has completed, and instead OnRewinded to know when OnPlayBackwards has completed :) Does it look ok, or my dizziness is making my miss something? :p
     
  12. mydingefnysen

    mydingefnysen

    Joined:
    Dec 15, 2011
    Posts:
    51
    That sounds great! The code I have right now works fine, but a OnRewinded would make it cleaner and nicer. Thanks again for all your help and effort!

    Edit:
    Ok, found one more thing to ask:) When using delay, is that only used the very first time the tween is started? Is there a way to have a delay every time I use a PlayForward() or PlayBackwards()?
     
    Last edited: Mar 21, 2012
  13. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    New Update: HOTween v0.8.142.

    - Added OnRewinded callback.
    - Fixed bug where OnUpdate wasn't called when Rewind was called.

    @mydingefnysen: yup, delay is used only the very first time. If you want it to work as a constant interval, you can use Sequences instead:
    Code (csharp):
    1.  
    2. // Create a sequence.
    3. mySeq = new Sequence( /*SequenceParms*/ );
    4. // Add an 0.7 seconds interval as the first element of the sequence.
    5. mySeq.AppendInterval( 0.7f );
    6. // Add a Tweener to the sequence.
    7. mySeq.Append( /*your tween*/ );
    8.  
    You can set callbacks both for elements inside the Sequence (Tweeners or other Sequences), than for the main Sequence, so you can control everything you want :)
     
  14. mydingefnysen

    mydingefnysen

    Joined:
    Dec 15, 2011
    Posts:
    51
    Thanks a lot! Everything works like a charm now!
     
  15. MitchStan

    MitchStan

    Joined:
    Feb 26, 2007
    Posts:
    568
    Hi,

    I'm just starting to use HOTween. I'm getting a lot done in 2 days - great framework and wonderful documentation. Great work and thank you for your efforts.

    I'm new to tweening - I used iTween a little bit last year. I usually do all my animations with either Slerping, Lerping, various Mathf functions, and I use animations created with the Unity animation window, so it's a mixed bag of tricks.

    I'd like to see how and when I can use HOTween to my advantage. I believe the easetypes is the biggest motivation - it gives animation a more organic feel.

    With that said, I have a few questions, perhaps someone here can point me in the right direction. Please forgive my ignorance. I'm not a programmer or graphics artist by trade so perhaps my questions may seem a little newbish. But I have read all the docs and this forums thread and the HOTween thread. So here are my initial questions:

    1] I use TextMate to write my code so code complete does not work with HOTween. Is there a way to make code complete work with HOTween's API in TextMate?

    2] I can't seem to find a complete list of the properties that can be animated. The examples show "position" "rotation" "scale" but since I don't have code complete I'm just guessing at what's animatable. Am I missing something or do the docs not have a complete list?

    3] Is "localPosition" a property that can be animated? I tried it, seemed to work, but not as I hoped. I was hoping it would animate in the transform's local coordinate system but it seems to not take into account the transforms local rotation.

    4] I have a specific example of an animation that was relatively easy to set up with Unity's animation window, but I'm struggling to recreate it with HOTween. The animation is of a box being lifted up in a semi arc. The lifting up part is easy enough (using JS by the way):

    Code (csharp):
    1.             // set up TweenParms
    2.             var parms : TweenParms = TweenParms();
    3.             // Property is position, we want to move forward by the distance, true for relative (not absolute)
    4.             parms.Prop("position", characterController.height*transform.up, true);
    5.             parms.Ease(EaseType.EaseInOutStrong);
    6.             // call the tween, store the result
    7.             aTween = HOTween.To(arm.transform, 1.5, parms);
    8.  
    So this lifts the box straight up (using transform.up) from it's starting position to the characterController's height, relative position.

    But the semi arc part has me stumped. What I'd like to see in the animation is while the box is being lifted up, it's also moved out in the transform.forward direction and back. Essentially the transforms.forward.z value goes from 0 to 3 and back to 0 again while at the same time the transform.up.y goes from 0 to characterController.height.

    Perhaps this is easy, but since I'm new at tweening I'm struggling to see my way through. Any advice/thoughts?

    Thanks for taking the time to read this. And thanks for any help.

    Mitch

    PS - By the way, I'm using HOTween with AngryAnt's Behave framework and it's a fabulous combination. Tween.isComplete is perfect for triggering BehaveResult.Success or BehaveResult.Failure. NIce stuff!
     
    Last edited: Mar 23, 2012
  16. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Hey Mitch :)

    Glad you're liking it, and glad it works nicely with AngryAnt's Behave. I still didn't try it, but it looks awesome and sooner or later will move to it.

    Uhm, starting with the long list of answers:

    1) About this I hope someone else will have an answer for you, cause I own no Mac so I have no idea how TextMate works. Using HOTween without code completion is very bad, I recon, but I think it must be something as easy as manually adding HOTween's DLL into the TextMate framework.

    2) There is no list of properties that can be animated because there is no limit to properties that can be animated :) If a property of an object can be read/written via script, than it can be animated with HOTween (as long as it's numerical - meaning Vectors, Rects, float, ints, etc. - or a string).

    3) Yup, "localPosition" can be animated. If you post your non-working example I might check what's wrong. I animate both that than "localRotation" a lot, and I didn't encounter any issue.

    4) When you create a semi arc animation in the Animation panel, in practice what you're doing is tweening x, y and z coordinates of an object separately, and with different ease types. You can do the same with HOTween (using PlugVector3X/Y/Z). Here is an example (which leaves out the Z property just because I was too lazy to set the camera correctly, but it's commented in there). If instead you want those properties to move in different times and create a full arc, best way would be a Sequence (that too is in the example package).

    Daniele

    P.S. the example is in C# but it should be easy enough to understand even if you're a JS user. If you have issues let me know.
    P.P.S. HOTween DLL is not part of the example package: you should add it yourself.
     
    Last edited: Mar 23, 2012
  17. MitchStan

    MitchStan

    Joined:
    Feb 26, 2007
    Posts:
    568
    Thanks, Daniele for responding to my long list of questions. So much to learn!

    I will look at the sample project. That will help me a lot. Thank you.

    I'm going to revisit and try again with the locallPosition. Perhaps I set ip up incorrectly.

    I did try and use the PlugVector3X/3Y/3Z but again, I couldn't make it work as expected with the transforms local co-ordinate system. It seems to default to world co-ordinates. I'll try again and see where I went wrong.

    If anyone can guide me as to how to get the autocomplete for HOTween working in TexMate I would appreciate it.

    Mitch
     
  18. Wild-Factor

    Wild-Factor

    Joined:
    Oct 11, 2010
    Posts:
    607
    I'm starting to work with HOTween and it's great!
    What about memory allocation ? (for iphone)
    can we recycle hotween object ?

    thanks
     
  19. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @MitchStan: if you still have issues with the local coordinate system send me a package with it - if you want. I'm using local coordinates to tween objects inside other tweened objects, and it's working perfectly. But, who knows, maybe you hit a HOTween bug.

    @Hercule: you can call HOTween.Init to set HOTween's object to permanent. This way, it won't be destroyed when all tweens are complete, but will stay there to wait for other tweens to be added.
    If instead you meant to recycle Tweeners and Sequences, you can store them and re-use them as long as you want (though you'll have to set their autoKill behaviour to false), and as long as you don't need to change their start/end values (other properties like timeScale etc. can instead be changed at any moment).
    I'm using it right now on an Android/iOS game in development, which contains tons of tweens, and it's working really nicely :)
     
  20. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    By the way, just added a Best Practices section to HOTween's tips (refresh the page if you don't see it).
     
  21. hima

    hima

    Joined:
    Oct 1, 2010
    Posts:
    183
    My solution is writing a class that wrap a PackedSprite from SpriteManager. Then you can write a getter/setter property for color that actually use the SetColor method of PackedSprite.

    Then you can use HOTween to just tween the color property. It's much easier than using OnUpdate! :)
     
  22. Wild-Factor

    Wild-Factor

    Joined:
    Oct 11, 2010
    Posts:
    607
    That's great thanks.
     
  23. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Big update (at least internally): HOTween v0.9.001

    HOTween now has an OverwriteManager :) It stays in the background and automatically manages when a running tween should be overwritten by another one which just started. Works smoothly with sequences too. To enable it, you have to call once:
    Code (csharp):
    1. HOTween.EnableOverwriteManager();
    Documentation is here.
     
    Last edited: Mar 26, 2012
  24. racocvr

    racocvr

    Joined:
    Dec 9, 2011
    Posts:
    9
    That's a nice solution! Thanks for sharing!
     
  25. badawe

    badawe

    Joined:
    Jan 17, 2011
    Posts:
    297
    Hi there!
    Can we use HoTween to change some shader properties?

    Like this:

    this.renderer.material.SetFloat("_SliceAmount", fDissolve );
     
  26. yavadoo

    yavadoo

    Joined:
    Mar 24, 2012
    Posts:
    102
    Very cool stuff and all for free. Thank you very much.

    Is there something like the "shake" in ITween?
    Or do I have adjust the size/position by myself in a loop?
     
  27. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @badawe: sure, but in that case you'll need to tween a float variable, and than apply it in an OnUpdate callback, like:
    Code (csharp):
    1.  
    2. public float myFloat = 0;
    3.  
    4. void Start()
    5. {
    6.    // Create a tween which will animate myFloat
    7.    // from 0 to 3 in 1 second, and will use an OnUpdate callback.
    8.    HOTween.To( this, 1, new TweenParms().Prop( "myFloat", 3 ).OnUpdate( OnTweenUpdate ) );
    9. }
    10.  
    11. void OnTweenUpdate()
    12. {
    13.    // Use myFloat value to set shader.
    14.    this.renderer.material.SetFloat( "_SliceAmount", myFloat );
    15. }
    16.  
    @yavadoo: glad you like it :) No "shake" for now, sorry: you will need to implement it in a looped tween or Sequence (or, if you like HOTween, you can still use iTween for the shake effect and HOTween for other animations: they're perfectly compatible).
     
  28. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    New update: HOTween v0.9.002

    - Fixed bug with OverwriteManager erroneously overwriting tweens in case Restart
    was called without previously starting a tween.
    - Various optimizations (mainly to the PlugVector3Path system) thanks to stfx.
     
  29. badawe

    badawe

    Joined:
    Jan 17, 2011
    Posts:
    297
    Hello!

    Thanks for the great work with HOTween!

    I'm trying to use a group of tween to make some menu animations, but i can't manage this to work, can you help me?

    I have one function show:
    Code (csharp):
    1.  
    2. public void Show()
    3.     {
    4.         HOTween.To(goLogo.transform, 1f,
    5.             new TweenParms()
    6.             .Prop("localPosition", new Vector3(0,290,0))
    7.             .IntId(15)
    8.             .Ease(EaseType.EaseInOutBack)
    9.             .AutoKill(false)
    10.             );
    11.        
    12.         btnEstrelaMenu.gameObject.transform.localScale = new Vector3(0,0,0);
    13.         HOTween.To(btnEstrelaMenu.gameObject.transform, 1.0f,
    14.             new TweenParms()
    15.             .Prop("localScale", new Vector3(1, 1, 1))
    16.             .Delay(0.5f)
    17.             .IntId(15)
    18.             .Ease(EaseType.EaseOutElastic)
    19.             .AutoKill(false)
    20.             );
    21.        
    22.        
    23.         HOTween.To(goContinuar.transform, 0.5f,
    24.             new TweenParms()
    25.             .Prop("localPosition", new Vector3(-155, -306, 0))
    26.             .Delay(1f)
    27.             .IntId(15)
    28.             .Ease(EaseType.EaseOutBack)
    29.             .AutoKill(false)
    30.             );
    31.        
    32.         HOTween.To(goJogar.transform, 0.5f,
    33.             new TweenParms()
    34.             .Prop("localPosition", new Vector3(3, -306, 0))
    35.             .Delay(1.2f)
    36.             .IntId(15)
    37.             .Ease(EaseType.EaseOutBack)
    38.             .AutoKill(false)
    39.             );
    40.        
    41.         HOTween.To(btnRegras.transform, 0.5f,
    42.             new TweenParms()
    43.             .Prop("localPosition", new Vector3(160, -306, 0))
    44.             .Delay(1.4f)
    45.             .IntId(1)
    46.             .Ease(EaseType.EaseOutBack)
    47.             .AutoKill(false)
    48.             );
    49.        
    50.         btnMenuOpcoes.gameObject.transform.localScale = new Vector3(0,0,0);
    51.         HOTween.To(btnMenuOpcoes.transform, 0.5f,
    52.             new TweenParms()
    53.             .Prop("localScale", new Vector3(1, 1, 1))
    54.             .Delay(0.5f)
    55.             .IntId(15)
    56.             .Ease(EaseType.EaseOutBack)
    57.             .AutoKill(false)
    58.             );
    59.        
    60.     }
    61.  
    And one to hide:
    Code (csharp):
    1.  
    2. public void Hide()
    3.     {
    4.         HOTween.PlayBackwards(15);
    5.     }
    6.  
    But this don't work!

    What I'm doing wrong?
     
  30. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @badawe: I'm running out right now, but I'll check what's wrong when I'm back (though it might be tomorrow), and also show you an example of how it can be done better by using a Sequence :)
     
  31. badawe

    badawe

    Joined:
    Jan 17, 2011
    Posts:
    297
    Humm...

    sad, maybe if i save all tween references and call one by one this work?
     
  32. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Hey was just trying to get HOTween Editor to run and When I extract the files all I get is folders with asset and pathname in it. Is the extension wrong or something? I'm not seeing the extracted files as a unitypackage. Trying this on Mac
     
  33. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I'm also intrested in getting color tweening to work. So far I have

    Code (csharp):
    1.  
    2. parms.Prop ( "_Color", new PlugSetColor ( Color.red ) );
    3.  
    and nothing is happening, can you point me in the right direction?
     
  34. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I'm getting a Failed assemblies stripper error when building for iOS, this occurs when stripping is at max. Anyone else run into this issue? It has only seemed to pop up after adding HOTween to my project.
     
  35. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @wightwhale: Just checked: the HOTween Editor ZIP correctly contains a Unity Package. A unityPackage is actually a compressed archive for Unity, what's happening is that maybe your extractor is extracting both the ZIP than the unityPackage?
    About the color tween, I suppose you're simply tweening the main color property of a material, so it is done simply as this:
    Code (csharp):
    1.  
    2. parms.Prop( "color", Color.red );
    3.  
    About the failed assemblies stripper error, this is the first time it's reported. I don't have a Mac so I can't check it out: could you try compiling a project which only contains HOTween, so we can see if it's his fault? And in that case, could you post the complete error output you're getting? Thanks :)

    @badawe: going to check what's wrong right now :)
     
  36. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    New update: HOTween v0.9.003

    - Fixed bug in HOTween.PlayBackwards method.

    @badawe: I'm very sorry. It turned out you incurred in a HOTween bug (HOTween.PlayBackwards was calling Play instead than PlayBackwards on the Tweeners). Fixed in this release.
     
  37. badawe

    badawe

    Joined:
    Jan 17, 2011
    Posts:
    297
    Thanks! =D
     
  38. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    So I made an empty project on unity mac and I have the same issue.

    Here is the error log. On another forum someone said it was .NET related which isn't supported in micro mscorelib. But as to which line of code are causing the problem i'm not sure.

    UnityException: Failed assemblies stripper: /Applications/Unity/Unity.app/Contents/Frameworks/Mono/bin/mono "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedBytecodeStripper/UnusedBytecodeStripper.exe" -l none -c link -out output -x "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedBytecodeStripper/link.xml" -d "Temp/StagingArea/Data/Managed" -x "tmplink.xml" current dir : Temp/StagingArea/Data/Managed
    result file exists: False
    stdout:
    stderr: Unhandled Exception: Mono.Linker.ResolutionException: Can not resolve reference: System.Reflection.Emit.OpCode System.Reflection.Emit.OpCodes::Ldind_I1 at Mono.Linker.Steps.MarkStep.MarkField (Mono.Cecil.FieldReference reference, System.Object markedby) [0x00000] in <filename unknown>:0 at Mono.Linker.Steps.MarkStep.MarkInstruction (Mono.Cecil.Cil.Instruction instruction, Mono.Cecil.MethodDefinition markedby) [0x00000] in <filename unknown>:0 at Mono.Linker.Steps.MarkStep.MarkMethodBody (Mono.Cecil.Cil.MethodBody body) [0x00000] in <filename unknown>:0 at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00000] in <filename unknown>:0 at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00000] in <filename unknown>:0 at Mono.Linker.Steps.MarkStep.Process () [0x00000] in <filename unknown>:0 at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0 at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0 at UnusedBytecodeStripper.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

    UnityEditor.MonoProcessUtility.RunMonoProcess (System.Diagnostics.Process process, System.String name, System.String resultingFile)
    UnityEditor.MonoAssemblyStripping.MonoLink (BuildTarget buildTarget, System.String managedLibrariesDirectory, System.String[] input, System.String[] allAssemblies, UnityEditor.RuntimeClassRegistry usedClasses)
    UnityEditor.HostView:OnGUI()



    Error building Player: Building player scripts failed.
     
  39. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I think the problem with the extracting is a problem with the compression on macs. I downloaded stuffit extractor and I was able to extract the unity package from the zip file but by default I was unable to do so. My suggesting would be to provide the .unitypackage on your site as well as the .zip.
     
  40. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    900
    Have not been on the thread for a while , happy to see OverwriteManager , im gonna have to try this out as I currently have a scenario with a lift ( like elevator action ) fully animated by hotween, where the user can change direction , so I was having to always kill the current tween to start another. HOTween.Init is also a great Idea !
     
  41. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @wightwhale: uhm, I think I know what might be causing that compilation issue, though it might be complicated to solve... Can you tell me for what iOS platform are you compiling?
    By the way, on HOTween's Google Code page I just put the unzipped HOTween Editor UnityPackage in the downloads.

    @tictox: OverwriteManager should work perfectly for that elevator action :) (I use it in a similar way for flipping menu panels, so that if a "go away" animation is called, any "come in" animations are overwritten).
    And remember that HOTween.Init must be called once, but BEFORE you create any tween (best moment is in the first lines of your application).
     
  42. badawe

    badawe

    Joined:
    Jan 17, 2011
    Posts:
    297
    I Get som errors here to, when compile to iOS 5.1 with unity3.5 Use micro mscorlib
     
  43. mydingefnysen

    mydingefnysen

    Joined:
    Dec 15, 2011
    Posts:
    51
    @Izitmee: About the OverwriteManager you said "(I use it in a similar way for flipping menu panels, so that if a "go away" animation is called, any "come in" animations are overwritten)". Doesnt the PlayBackwards and forwards work the same way if you only use one stored tweener or did I miss something? Im also tweening menues so its importants nothing gets stuck somewhere :)
     
  44. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    @mydingefnysen: ehe, what you said is totally right, but doesn't work on my case because I'm using two different types of animations for "menu in" and "menu out" (mainly, they enter from the right side and leave from the left). So the OverwriteManager makes a good job of overwriting the tween for the same transform.position, and substituting it with the new one.

    @badawe: thanks. Now I'm sure what's causing that issue. It's the Emit class, which is actually not used by HOTween on iOS, since they're not compatible (while it's used on other platforms to gain a little more performance). Seems like micro mscorlib doesn't want it in there at all. I will try to find a solution, other than creating a "micro HOTweenlib"...
     
  45. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I'm building for Target iOS Version 5.0, SDK Version iOS latest, Api Compatability level .NET 2.0 Subset, Stripping level use microcore mslib, script call optimization Fast but no exceptions.
     
  46. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Sadly, the only solution for that issue is probably to have two different HOTween DLLs, one for normal compilation, and the other compatible with micro mscorlib. Will try that during the day, and let you know.

    Other than that, I wanted to mention that stfx has become an HOTween committer, and is giving a big hand with code optimizations (not to mention scolding me for my coding style) :)
     
  47. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Help needed :)

    stfx is testing out possible alternate implementations of HOTween, and we'd need to know if this one is compatible with iOS micro mscorlib. Could any of you be so kind as to test this unityPackage (ZIP version / direct UnityPackage version) with micro mscorlib compilation? It shows a cube moving from top left to bottom right.

    Thanks :)
     
    Last edited: Apr 3, 2012
  48. mydingefnysen

    mydingefnysen

    Joined:
    Dec 15, 2011
    Posts:
    51
    Ill see if I got some time test it out tomorrow when I get to the office!
     
  49. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    That would be awesome mydingefnysen :) Please use this package instead of the previous one: ZIP / UnityPackage
     
    Last edited: Apr 3, 2012
  50. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Hmm, this might be exactly what I am looking for.

    I need to animate stuff independent from timeScale, can I do this easily with hotween, anyone point me where to start? Also, hotween good for iOS?

    Thanks