Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice

HOTween: a fast and powerful Unity tween engine

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

  1. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    445
    Official HOTWeen site seems to be not working!

    I'm trying to generate a build for Windows Phone 8 but I got this error :

    Error building Player: Exception: Error: type `System.Reflection.Emit.AssemblyBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.ModuleBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.AssemblyBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.AssemblyBuilderAccess` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: method `System.Reflection.Emit.AssemblyBuilder System.AppDomain::DefineDynamicAssembly(System.Reflection.AssemblyName,System.Reflection.Emit.AssemblyBuilderAccess)` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.AssemblyBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.ModuleBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: method `System.Reflection.Emit.ModuleBuilder System.Reflection.Emit.AssemblyBuilder::DefineDynamicModule(System.String)` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.ModuleBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: method `System.Reflection.Emit.TypeBuilder System.Reflection.Emit.ModuleBuilder::DefineType(System.String,System.Reflection.TypeAttributes)` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: method `System.Void System.Reflection.Emit.TypeBuilder::AddInterfaceImplementation(System.Type)` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.ConstructorBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: method `System.Reflection.Emit.ConstructorBuilder System.Reflection.Emit.TypeBuilder::DefineDefaultConstructor(System.Reflection.MethodAttributes)` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: method `System.Type System.Reflection.Emit.TypeBuilder::CreateType()` doesn't exist in target framework. It is referenced from HOTween.dll at System.Reflection.Assembly FastDynamicMemberAccessor.MemberAccessor::EmitAssembly().
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.MemberAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.MemberAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.MethodBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.MethodBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: method `System.Reflection.Emit.MethodBuilder System.Reflection.Emit.TypeBuilder::DefineMethod(System.String,System.Reflection.MethodAttributes,System.Type,System.Type[])` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.MethodBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: method `System.Reflection.Emit.ILGenerator System.Reflection.Emit.MethodBuilder::GetILGenerator()` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.MethodBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.MethodBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: method `System.Reflection.Emit.MethodBuilder System.Reflection.Emit.TypeBuilder::DefineMethod(System.String,System.Reflection.MethodAttributes,System.Type,System.Type[])` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.MethodBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: method `System.Reflection.Emit.ILGenerator System.Reflection.Emit.MethodBuilder::GetILGenerator()` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.PropertyAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.MethodBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.MethodBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: method `System.Reflection.Emit.MethodBuilder System.Reflection.Emit.TypeBuilder::DefineMethod(System.String,System.Reflection.MethodAttributes,System.Type,System.Type[])` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.MethodBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: method `System.Reflection.Emit.ILGenerator System.Reflection.Emit.MethodBuilder::GetILGenerator()` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitSetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.MethodBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.TypeBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.MethodBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: method `System.Reflection.Emit.MethodBuilder System.Reflection.Emit.TypeBuilder::DefineMethod(System.String,System.Reflection.MethodAttributes,System.Type,System.Type[])` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: type `System.Reflection.Emit.MethodBuilder` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
    Error: method `System.Reflection.Emit.ILGenerator System.Reflection.Emit.MethodBuilder::GetILGenerator()` doesn't exist in target framework. It is referenced from HOTween.dll at System.Void FastDynamicMemberAccessor.FieldAccessor::_EmitGetter(System.Reflection.Emit.TypeBuilder).
     
  2. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @fxcarl: fast dynamic accessors are a slightly modified version of this code by James Nies. If you still prefer having them public in HOTween, instead than just the code, let me know :)

    @Wagenheimer: HOTween website was down due to server change. It's up again now: http://www.holoville.com/hotween
    To compile for Win8, you need HOTweenMicro (in the downloads section of the website)
     
  3. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    *IMPORTANT UPDATE*
    New HOTween Update: v1.2.010

    - Added PixelPerfect Method Parameter, so that you can tween floats/Vector2/3 using only integers (also works with PlugVector3X/Y/Z)
    - Fixed constant movement on curved paths not working anymore

    Last version is on the website.
     
  4. ehudros

    ehudros

    Joined:
    Nov 14, 2013
    Posts:
    5
    @Izitmee - Thanks for a great Tween engine. One thing that I really miss from my days with TweenMax is a LoopDelay option. Currently, the only way implement a delayed yoyo loop is use a sequence, which is a hassle (and can't be done through the component editor). Is there any chance you'll add a loop delay option to tweeners?
     
  5. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    I actually thought if I should consider delays when looping, when I made the engine, but decided against it. I totally don't remember why :D I added it to the enhancements list on Google Code, but I don't know how soon I'll have the time to do it.
     
  6. cupsster

    cupsster

    Joined:
    Apr 14, 2009
    Posts:
    363
    Any idea what can be wrong?

    I got this error:
    InvalidCastException: Cannot cast from source type to destination type.
    Holoville.HOTween.Plugins.Core.ABSTweenPlugin.SetValue (System.Object p_value) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Plugins/Core/ABSTweenPlugin.cs:588)
    Holoville.HOTween.Plugins.Core.ABSTweenPlugin.Complete () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Plugins/Core/ABSTweenPlugin.cs:492)
    Holoville.HOTween.Plugins.PlugVector3Path.Complete () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Plugins/PlugVector3Path.cs:573)
    Holoville.HOTween.Tweener.Update (Single p_shortElapsed, Boolean p_forceUpdate, Boolean p_isStartupIteration, Boolean p_ignoreCallbacks, Boolean p_ignoreDelay) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Tweener.cs:823)
    Holoville.HOTween.Tweener.Update (Single p_shortElapsed, Boolean p_forceUpdate, Boolean p_isStartupIteration, Boolean p_ignoreCallbacks) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Tweener.cs:683)
    Holoville.HOTween.Core.ABSTweenComponent.Update (Single p_elapsed) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Core/ABSTweenComponent.cs:954)
    Holoville.HOTween.HOTween.DoUpdate (UpdateType p_updateType, Single p_elapsed) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/HOTween.cs:2073)
    Holoville.HOTween.HOTween.FixedUpdate () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/HOTween.cs:692)
     
  7. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Hey cupsster. Update to the latest HOTween version (came out on the Asset Store a couple days ago), since you seem to have different line numbers than me, and I can't see what's happening. Also, write me the code you're using to animate along that path, so I can check it out.
     
  8. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    Hello Izitmee,

    First of all : Wonderful tool, thanks a bunch !

    Then I'm looking for some bit of help.
    Currently, as far as i understand, one can't create a sequence of tweens using the Visual Editor. Too bad for me, I don't understand nothing about scripting.
    Anyway, I tried.
    Here is what I try to achieve :

    I have an object with a Tween called "bouncebtn". It makes my button bounce(amazing).
    I want to drop a J script on my object so that I can sequence the bounce, then a 1sec pause, then bounce again, ad vitam...

    Here is my code so far:

    Code (csharp):
    1. #pragma strict
    2. import Holoville.HOTween;
    3.  
    4.  
    5. function Start () {
    6.  
    7.     Sequence mySequence = new Sequence();
    8.    
    9.     mySequence.Append(HOTween.Play("bouncebtn"));
    10.     mySequence.AppendInterval(1);
    11.     mySequence.Play();
    12.  
    13. }
    14.  
    15. function Update () {
    16.  
    17. }
    I can't get it to work at all, it's asking me for comma on line 7, which is already there...

    Would anyone here be kind enough to point me to the right direction, knowing these are my first steps in scripting ? :)

    thanks !
     
  9. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Hey bchevalier,

    I never thought of "tricking" HOTween into creating Sequences with tweens made by the Visual Editor. I did test it right now, and it actually works. Good find :)

    The conditions to do that are:
    - Set the Visual tween so that it doesn't destroy after completion
    - Set the Visual tween so that it doesn't start automatically

    Also, in your case, you have various issues:
    1) you're using C# syntax mixed with JavaScript/UnityScript syntax (and thus you get that weird error)
    2) since you want a loop of a loop (button going up then down, then pause, then loop), you'll have to set the Visual tween so that it loops twice, with a Yoyo looptype (so you get the up/down/jump behaviour). Then you'll have to add an interval to the sequence that takes into account also the tween's loop (since Sequences don't take tweeners loops into account automatically). And finally set the sequence to loop indefinitely, like this (using UnityScript - which I don't use since ages, so I hope it's all correct):
    Code (csharp):
    1.  
    2. var mySequence:Sequence = new Sequence(new SequenceParms().Loops(-1));
    3. // Append the tween with the given id
    4. // MIND: it works only if you use that ID only for a single tween
    5. seq.Append(HOTween.GetTweensById("bouncebtn", false)[0]);
    6. // Now append an interval that is equal to the duration of the tween without loops,
    7. // plus the actual interval you want to append
    8. seq.AppendInterval(1);
    9.  
     
  10. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    Wooooooow

    Thanks man, this helped a lot !
    I had a chat with my programer as well and she convinced me to switch to C sharp so it would be easier for me given that usual example codes are in C.

    Here is my code in C now, using you're indications :

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Holoville.HOTween;
    4.  
    5. public class bouncebtnC : MonoBehaviour {
    6.  
    7.     void Start () {
    8.  
    9.     Sequence mySequence = new Sequence(new SequenceParms().Loops(-1));
    10.    
    11.     mySequence.Append(HOTween.GetTweensById("bouncebtn", false)[0]);
    12.     mySequence.AppendInterval(4);
    13.    
    14.     mySequence.Play();
    15.    
    16.     }
    17.     void Update () {
    18.    
    19.     }
    20. }
    21.  
    What it does is playing a very subtle bounce I did using your Visual Editor every 4 seconds. Perfect when you want to draw attention to something on a static screen without creating too much visual noise.

    Now for me, using HOTween means I won't have to bother my programer when I need specific contextual and generic animations on the UI.
    Also, as an artist, I was thinking that logically, I "should" be able to sequence Tweens I created using the Visual Editor, so once again I wouldn't have to bother my programer with detailed explanation of animations I could do myself. I'm very glad it is possible :)

    Finally, I'm looking at using HOTween for much more, like shader animations.
    My idea is simple and a button is a good example.
    I design a bounce tween for my button. I design a text shader with 2 layers (1 for the text itself, 1 with an overlaid shiny FX I want to control/sequence using HOTween).
    I would sequence the bounce and the shader animation using a sequence script, now that I know how to do that :)

    My issue is the following : I can't seem to have access to the variables within my shader from HOTween Visual Editor. They're exposed, I can tweak them in Unity, but I can't find them using HOTween Visual Editor.
    Here's my shaders exposed inputs :
    $Screen Shot 2014-02-17 at 22.04.05.png
    But then I can't find these inputs using the HOTween Visual Editor. Here's what I get :
    $Screen Shot 2014-02-17 at 22.09.08.png
    I can't seem to have access to my second texture + the main texture seem to have different name. Color as well.
    How do you actually retrieve this infos regarding the shaders ? It seems in that case that HOTween proposes a premade list of propeties.

    As an example, MaterialMotion(it's sort of a tween engine but for Materials only) lets me input the name of the texture slot I want to animate on any given shader.
    Do you think something like this would be doable with HOTween ?
    One of the many limitations of MaterialMotion is that only materials offset/Tiling can be animated with it, not the colour or any other type of vector/value. I'm hoping to achieve something like that with HOTween :)

    Edit : actually I realised that I should be able to reach these properties(any, actually) if I script the Tweens rather than using the Visual Editor, right ?
    Also, being able to tweak the Tweens without having to re-compile the scripts is really really handy. I just script my Tweens sequence, make sure my timing is fine, then finetune the Tweens using the Visual Editor...

    Thanks !
    ben

    ps : sorry for the lengthy message...
     
    Last edited: Feb 17, 2014
  11. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    btw, thanks a bunch for the tips on how to achieve the effect on the TWeen(loop twice + yoyo).

    I did it slightly differently in the end, like this :
    $Screen Shot 2014-02-17 at 22.24.24.png

    I turned out pretty ok :)
     
    Last edited: Feb 17, 2014
  12. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Great you got it :)

    About shader properties, those are a completely different beast. They're not really variables, but a weird thing, so they can't be accessed directly (apart from the offset/tiling of the main texture, because Unity kind of caches them). HOTween has a special plugin which can tween them, but it's only accessible via script. Still, you could attach a MonoBehaviour to the gameObject whose shader you want to tween, and add some accessors there that change the shader property, like this:
    Code (csharp):
    1.  
    2. public Vector2 planarTexOffset {
    3.   get {
    4.     return renderer.material.GetTextureOffset("_PlanarTex");
    5.   }
    6.   set {
    7.     renderer.material.SetTextureOffset("_PlanarTex", value);
    8.   }
    9. }
    10.  
    Then, with the Visual Editor, you'll be able to tween the property "planarTexOffset" of that MonoBehaviour, which will automatically change the properties of the shader.
     
  13. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    hooo I see !! Very nice.
    I'm going to try this very soon. Thank you for you help and explanations !
     
  14. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    Hi !

    It worked super great :)
    I also used a variant to control a dissolve property on one of my custom shaders, took me some time to understand i was working with a Float, haha i suck so much...

    Anyway, I can now have full control over my shaders properties !
    It's a great improvement because I can finetune repetitive animations like second layers, flowmaps, dissolve, all kind of crazy stuff without having to :
    - bake the values into the shader(and compile)
    - re-compile if I was controlling the shaders by script directly
    - use that crappy Unity Animation Timeline tool(sorry, but it's real crap)

    One thing I was wondering : there's a Duplicate Tween option in the Visual Editor. Is there a way for me to actually Duplicate a Tween and then change it's Target ?
    Like I want to use that same Tween on multiple target. I know that by code it would be easy to do, but what about visually ?

    Thanks !
     
  15. Kobix

    Kobix

    Joined:
    Jan 23, 2014
    Posts:
    12
    Dunno, it is fixed now :) Also, great stuff this library. If we make any money off our game, you will 100% get a piece of cake!
     
  16. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Sorry for the late reply but it's not working for me :(.

    I'm using HOTween.IsTweening(Screen01); which means that for every tweenable screen there is I need to check if it's tweening (in the case of my app 9 screens). So I made a function:

    Code (csharp):
    1.  
    2. function ScreenTween() : boolean
    3. {
    4.    if(HOTween.IsTweening(Screen01) || HOTween.IsTweening(Screen02)) //etc
    5.    {
    6.       return true
    7.    }
    8.    else
    9.    {
    10.       return false
    11.    }
    12. }
    13.  
    So when I want to use HOTween.To i'll do:
    Code (csharp):
    1.  
    2. if(!ScreenTween)
    3. {
    4.      HOTween.To();
    5. }
    6.  

    But now my screens aren't functioning because it's always returning true :(
     
  17. DanTaylor

    DanTaylor

    Joined:
    Jul 6, 2013
    Posts:
    42
    Hello!
    First off, HOTween is rad - I have been using it for a while now and it is super versatile and super efficient - great stuff!

    I do, however, have a question...

    I'm writing some custom PlayMaker scripts to do a few specific things with HOTween. One of the things I need to do is...
    - Create a sequence in one action
    - Then add tweens by ID to the sequence using another action

    Is it possible to reference a sequence by ID?
    Or could I store the sequence in a PlayMaker variable some how?


    I'd be happy to share my actions once I get them all working!

    Thanks,
    Dan
     
  18. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @bechevalier: happy that it works great :) There is currenlty no way to visually duplicate a tween and change its target, because that would need a series of additional checks in case you're choosing a target which doesn't have the same properties, and I didn't add that. Sorry, but you'll have to do that by hand (or attach a TweenComponent to a prefab and just duplicate the prefab).

    @Kobix: Glad it's fixed! Can I get a piece of pizza instead, since I don't like sugary stuff much? :D

    @Tripwire: mhmm gonna have to test it. Will do that later today.

    @DanTaylor: all the main HOTween static methods work with IDs, both with Tweeners and Sequences. I'm not sure about how PlayMaker works, but if you can create a variable of type Sequence, you certainly can store your sequence in there.
     
  19. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    Izitmee : thanks for your answers !
     
  20. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    226
    Very good. Thanks a lot.
     
  21. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @Tripwire: I just made a test, and IsTweening is working correctly. Can you install the latest HOTween version, just to be sure, and then, if you still have this issue, create a sample barebone project which replicates this issue to send me, so I can check it out?
     
  22. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    97
    hi there! i need a little help here. i have a tween i want to play backwards, and it works but it plays the easing backwards which looks weird. so i want to be able to change the Ease type at the same time it runs backwards. i tried this but it doesn't work:


    HOTween.PlayBackwards("splash_moveout");
    new TweenParms().Ease(EaseType.EaseInBounce);

    my original tween had EaseOutBounce, so i think this should be the one that would be reversed. anyway, i don't think this works as it still behaves the same.

    any assistance appreciated!
     
  23. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Hi there :)

    To change a Tweener's ease after you created it, you have to memorize your Tweener in a variable when you create it, and then do like this:
    Code (csharp):
    1.  
    2. myTween.easeType = EaseType.EaseInBounce;
    3.  
     
  24. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    97
    OK, so i need to instance it, then. i do understand, but i created the tween in the GUI Editor so i don't know how you instance it. i typed something like this:

    Code (csharp):
    1. Tweener myTween = HOTween.GetTweensById("splash_moveout", false);
    but it doesn't work. so i'm just not sure how to form the code correctly to declare a instance as a variable.
     
  25. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,025
    Did you ever fix up the rotation problems with this package? I'd posted a sample project some time ago demonstrating the issues.
     
  26. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @metaphysician: GetTweensById returns a list of IHOTweenComponent interfaces, which is common both to Tweeners and Sequences. To get a Tweener instead (which you need to change the ease), you should do this (passing the target instead than an ID as a parameter):
    Code (csharp):
    1.  
    2. Tweener myTween = HOTween.GetTweenersByTarget(tweenTarget, false);
    3.  
    @SteveJ: hi Steve. After fiddling with it I posted an answer a while ago. Let me know your thoughts.
     
  27. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    97
    OK - got it - tweenTarget is a GameObject. should have been obvious really...but sorry, this is still not working. pasting that code in and replacing tweenTarget with gameObject i get:

    Cannot implicitly convert type `System.Collections.Generic.List<Holoville.HOTween.Tweener>' to `Holoville.HOTween.Tweener'

    so i know we're close. maybe there's a slight bit more, or the format isn't quite right, or its not casting correctly?

    another thing - how do you specify a particular tween on that target? maybe that's what's missing?

    Update - OK - i think i see where i'm wrong - GetTweensByTarget returns a list, but i need a specific tween on a specific target for the left side variable to work.

    Update2 - i just decide to create another tween instead to handle the other direction. it was actually easier than i thought. so no worries!
     
    Last edited: Feb 24, 2014
  28. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Glad you solved it. To explain things more, I'm not sure what you're tweening, but the target was probably the GameObject's Transform, and not the GameObject itself :)
     
  29. NK_Jake

    NK_Jake

    Joined:
    Feb 14, 2014
    Posts:
    2
    Hi izitmee, I was hoping you might have the answer to my question. I'm trying to tween a lot of enemies at the same time by creating an array full of spawner objects that all have hopath on them with separately defined paths, a group of enemies will be instantiated on top of each spawner and I'd then like to control the tweens from a level controller class. I figured out how to do it but I'm getting a null.position is missing error, and the target of the tween is 100% not null so I'm kind of confused what null.position has to do with moving a game object in the first place. Basically it's like this
    Code (csharp):
    1.  HOTween.To (spawn [0].controller[0], 5, new TweenParms ()
    2.                    .Prop ("position", paths [8].MakePlugVector3Path ())
    3.                    .Loops (-1, LoopType.Restart));
    Spawn is the array of game objects that are spawners, controller is the array of prefabs that are instantiated by a for loop on start() (in a different class, on a different game object), and paths is the array of HOPath objects. Any ideas?


    EDIT: I fixed it myself by targeting the transform of the gameObject i wanted to move because i'm stupid and forgot to do that... but I'm still interested in how hotween works since it gave me that null.position error. Does that just mean I had it targeting the wrong thing?
     
    Last edited: Feb 25, 2014
  30. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Hey Izitmee,

    we've been using HOTween before and love it ;) Now we're working on our first Windows Store game with Unity3D and the plugin prevents the game from being accepted by the store. I filed a bug report at https://code.google.com/p/hotween/issues/detail?id=68&thanks=68&ts=1393340765

    Do you create types and fields and run-time? And is that really necessary for a tweening plugin?

    Cheers,
    Nick
     
  31. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @NK_Jake: glad you solved it in the meantime. Still, that null.position is very weird. In case the target is null at creation, HOTween tells it to you (unless I changed the console logs and don't remember it). Anyway, it appears as if you were indeed having a null target, and not just the wrong one.

    @npruehs: Hi Nick. I just marked your bug as invalid ;) For Windows 8 Store you need HOTweenMicro (just replace the DLLs and the code stays the same), which doesn't use Emit. Otherwise, I use Emit in the regular version of HOTween so it goes a little faster.
     
  32. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Thanks, works like a charm :) Good job dude.
     
  33. Exer

    Exer

    Joined:
    Feb 25, 2014
    Posts:
    1
    Hi lztmee,

    We are currently working on a rail shooter game. We created a spline with the visual editor and animated an empty game object with a camera etc. as child objects. That works fine.
    The problem is that we want to change at some point of the track the speed of the animation . I already understand that I should use timescale to increase the speed of the player(like a boost). The thing is that I dont quite get how to update the timescale without restart the whole thing. Where should I place the HOTween.to so it gets updated when the timescale changes and while its running. Iam quite a beginner ( Iam a Gamedesigner) so sry if this is a dumb question ;-)



    Code (csharp):
    1.    
    2.  
    3.           Tweener myTween = HOTween.To(CubeTrans2,4, new TweenParms()
    4.                                  
    5.       .UpdateType(UpdateType.TimeScaleIndependentUpdate)
    6.      .TimeScale()
    7.      .Prop( "position", CubeTrans2.GetComponent<HOPath>().MakePlugVector3Path().OrientToPath())
    8.      .Loops(-1, LoopType.Restart));
    9.  
    10.      myTween.timeScale = TimeSpeed;
    11.                                                  
     
  34. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Okay, I was wrong. Replacing all files makes everything compile, but loading our first level causes the following error:

    ArgumentNullException: Argument cannot be null.
    Parameter name: type
    System.Activator.CheckType (System.Type type) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Activator.cs:378)
    System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Activator.cs:280)
    System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Activator.cs:268)
    System.Activator.CreateInstance (System.Type type, System.Object[] args) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Activator.cs:263)
    HOTweenManager.CreateTween (.HOTweenData p_twData, Single p_globalDelay, Single p_globalTimeScale) (at Assets/Holoville/HOTween Extensions/HOTweenManager/HOTweenManager.cs:124)

    while everything works fine with the "normal" HOTween. Anyone else experienced similar issues?
     
  35. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    @Exer: if you want your tween to depend on Unity's timescale, just remove the ".UpdateType(UpdateType.TimeScaleIndependentUpdate)" part and let Unity timescale control it completely :)

    @npruehs: that's an error related to the visual editor. Weird, it seems that you're getting a null plugin there (also weird because I know of games using HOTween on Windows 8 Store without issues). Can you manage to tell me what are you tweening there? Also, can you try to add this at the beginning of row 124 of HOTweenManager.cs?
    Code (csharp):
    1.  
    2. if (propData.pluginType != null) // rest of the code
    3. [CODE]
     
  36. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,092
    I have a Tweener that I get from a HOTween.To() call, which works perfect as usual. It rotates a sprite over a specified angle, which also works perfect.
    (For specifics, I rotate the sprite 135 degrees from angle 210 degrees to 345 degrees, not that that matters.)

    The only problem I have is that when I use HOTween.Pause() to pause the Tween, for some reason it sets my rotation degrees value to 0, and if I go into the editor and change the transforms rotation while it is Paused, the Tween automatically Tweens it to 0, despite the fact the Tween is supposed to be Paused. Is there something about the way HOTween tweens that causes this issue on Pause?

    Preferably, I'd like the sprite to just pause it's rotation mid-tween, so that the rotation in the transform stays the same when it pauses, then resumes when it unpauses. Currently, when I call HOTween.Play() after HOTween.Pause() , this sets the rotation back to the way it was before I paused and continues like normal, which is what I want. It's just pause causes the tween animation to janky because the rotation jumps.
     
  37. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Hi Ben. The way HOTween is built, there is no chance that it can change values when you pause it, since it simply stops updating the relative targets. I think you almost surely have something else changing the rotation of your target, which comes into play when HOTween is paused and not changing it anymore. This seems to be confirmed by the fact that everything continues normally when you unpause the tween.
     
  38. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,092
    Thank you for that info, helped me narrow down the problem and realize our artist checked Apply Root Motion on our 2D sprite animator, which apparently causes the problem on pause somehow.
     
  39. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    @Izitmee The null check removes the error messages - but the sprites aren't tweening any more (as expected). The plugin type was "PlugVector3" (screenshot attached). I re-assigned the plugin type just by clicking on the dropdown an choosing "PlugVector3" again. Now we got the following error:

    MissingMethodException: No constructor found for Holoville.HOTween.Plugins.Core.PlugVector3::.ctor(System.Single, System.Boolean)
    System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Activator.cs:319)
    System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Activator.cs:268)
    System.Activator.CreateInstance (System.Type type, System.Object[] args) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Activator.cs:263)
    HOTweenManager.CreateTween (.HOTweenData p_twData, Single p_globalDelay, Single p_globalTimeScale) (at Assets/Holoville/HOTween Extensions/HOTweenManager/HOTweenManager.cs:124)
    HOTweenComponent.Awake () (at Assets/Holoville/HOTween Extensions/HOTweenManager/HOTweenComponent.cs:56)

    $NullPlugin.png
     
    Last edited: Feb 27, 2014
  40. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    @Izitmee My co-worker fixed the issue. In the scene file, the pluginType fields were referencing the wrong dll.

    Before:
    _pluginType: Holoville.HOTween.Plugins.PlugVector3Y, HOTween

    After:
    _pluginType: Holoville.HOTween.Plugins.PlugVector3Y, HOTweenMicro

    Maybe you should release the .dll under the same names, or add a hint for transitioning between both.
     
  41. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    Billions of thanks to your co-worker :) I was not considering that option at all, since the internal DLL name should be the same. I'll find a viable solution, now that I know what it is.
     
  42. NK_Jake

    NK_Jake

    Joined:
    Feb 14, 2014
    Posts:
    2
    Can't build and export because of HOPath, anyone have a similar problem / how did you fix it?

    This is my error
    Code (csharp):
    1.  Assets/Holoville/HOPath/PathPreview.cs(2,7): error CS0246: The type or namespace name
    2. `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?
     
  43. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    I can't answer for HOPath, but the error means that PathPreview.cs is meant to be used only in the Editor.
     
  44. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    113
    I HAVE THE EXACT SAME PROBLEM. Fresh project, all new. When you try to BUILD you get this error message!

    Why

    Please I need this fixed... this asset is too awesome to be going to waste...
     
  45. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    113
    It is a brand new project, I never even used HOPath i just tried to build, and the error appears....

    It probably has something to do with this:

    https://docs.unity3d.com/Documentation/Manual/PlatformDependentCompilation.html

    I'm not pro at this, so can someone fix it for us please?

    Much appreciated
     
  46. crisbro

    crisbro

    Joined:
    Mar 2, 2014
    Posts:
    4
    I'm a newbie, hope my question isn't odd, but by using HOPath, how can you control the speed , I searched and found only timeScale property , and didn't helped me much. I want a lower speed than 1.
     
  47. crisbro

    crisbro

    Joined:
    Mar 2, 2014
    Posts:
    4
    Found out. I used

    .TimeScale(0.08f)
     
  48. crisbro

    crisbro

    Joined:
    Mar 2, 2014
    Posts:
    4
    When using .Loops(-1, LoopType.Yoyo) onto an animated character, what should I add/modify in order to rotate the character ( turnaround) at the end of the path.
     
  49. crisbro

    crisbro

    Joined:
    Mar 2, 2014
    Posts:
    4
    I think it is related with .OnComplete(...) , but not sure what to write inside.
     
  50. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,224
    I don't know if HOPath uses OnComplete like the regular HOTween, but if it does, you just write:
    Code (csharp):
    1.  
    2. .OnComplete(MyMethod);
    3.  
    So that it calls the MyMethod function, where you can place the rotation code.