Search Unity

iTween Visual Editor

Discussion in 'Made With Unity' started by dkoontz, Oct 27, 2010.

  1. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    Hello everyone, I'm releasing today my iTween Visual Editor for Unity 3. You can read all about what it can do and download it here. The short version is that you can take a GameObject, attach an iTweenEvent to it and then using the custom editor set up the tween properties and you get all the power and flexibility of iTween with zero code required. It's all free as in both beer and speech, licensed under the MIT license so I'd appreciate any feedback or suggestions (or improvements!).

    David Koontz
     
  2. dart

    dart

    Joined:
    Jan 9, 2010
    Posts:
    211
    Really interesting man, I´m surprised there are no replies yet. Good job.
     
    Last edited: Oct 28, 2010
  3. kodagames

    kodagames

    Joined:
    Jul 8, 2009
    Posts:
    548
    Hello dkoontz,

    Yes Great Job!!!

    I do have a question if you dont mind?

    if I uncheck the play automatically How would I call that itween event that was created with the iTween Editor, via code?

    Im just unsure of how to make the connection of that itween event that was created using the iTween visual editor, with a script that I create.

    Is there any chance you could do a simple button press example or GetKeyDown example? I hope I explained it right
     
  4. kodagames

    kodagames

    Joined:
    Jul 8, 2009
    Posts:
    548
    Well I thought I could figure it out But Still no luck :(

    I tried this:

    Code (csharp):
    1. function Update ()
    2. {
    3.    
    4.        
    5.     if(Input.GetKeyDown("a"))
    6.     {
    7.         iTween.Stop();
    8.         print("A is stopped");
    9.         //iTween.Resume(gameObject);       
    10.     }
    11.    
    12.     if(Input.GetKeyUp("a"))
    13.    
    14.     {
    15.         iTween.Resume();
    16.         print("A is now active");
    17.     }
    18. }
    But dont know how to call the tweens That were created with the Tween Editor?

    The documentation on iTween says when using key presses add a stop and then any new iTweens after that, but that means the ones in the Editor are deleted?

    Hmm.. Yeah I cant figure out how to make the connection. Is there any smart fellas out there that know how to call the Itween Events created with the Visual iTween Editor from a script?

    I thought if I did something like below it would work but Just not sure how to call iTween to play tweens that are on the object and Play Automatically is turned off?

    Code (csharp):
    1. function Update ()
    2. {
    3.    
    4.        
    5.     if(Input.GetKeyDown("a"))
    6.     {
    7.         iTween.Resume(gameObject);     
    8.     }
    9. }
     
    Last edited: Oct 29, 2010
  5. Ullukai

    Ullukai

    Joined:
    Aug 24, 2010
    Posts:
    746
    This is just totally Awesome ! Thanks, you just got a rid of lots of my scripts i won't need now !
     
  6. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    zeek: there's a Play method on the iTweenEvent component that will start the tween.

    Ullukai: that's exactly why I wrote it, glad it's helping out.
     
  7. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    Thank you very much!
     
  8. VPrime

    VPrime

    Joined:
    Mar 4, 2009
    Posts:
    74
    THis is pretty awesome. Thanks. Should save some time for the programmer on our game. I can do some of the "tweens" and save him the trouble :)

    Thanks for making it free!
     
  9. simone007

    simone007

    Joined:
    Oct 30, 2008
    Posts:
    221
    Thanks a lot, I love it!
     
  10. oxl

    oxl

    Joined:
    Nov 21, 2008
    Posts:
    325
    Hi,

    thanks very much for this, I'm pretty sure its very useful.

    But I have some problems unchecking the options, they always get instantly re-checked and the value reseted to zero.

    Any idea what I might miss or is it intended to work like this ?

    EDIT : It's working now. Restarting Unity solved it. Great ! :)

    Thanks,

    --
    oxl
     
    Last edited: Oct 28, 2010
  11. SamSam

    SamSam

    Joined:
    Aug 31, 2010
    Posts:
    44
    Hi,
    Thank you for this brilliant tool, i hadn't tried iTween before today and your editor sold it to me in second !

    How do you exactly trigger an event in code if i uncheck the play auto box ? I don't get it even with your post above ?
    I get errors when using this code :

    Code (csharp):
    1. // Update is called once per frame
    2.     void Update ()
    3.     {
    4.     if(Input.GetButtonDown("Horizontal"))
    5.         {
    6.             iTween();
    7.         }
    8.     }

    What if i put multiples iTweenEvents on a gameObject and want to trigger by code only one of them on a reason, more than one on another reason ? Is it possible to distinguish each iTweenEvents attach to a gameObject in the code ?

    Thank you.
     
    Last edited: Oct 28, 2010
  12. Nick3d

    Nick3d

    Joined:
    Jan 28, 2010
    Posts:
    100
    That's nice!
    Is there a wat, other to change color, to change the actual texture on an object? switching from a texture to another?

    thanks, this is really useful for someone who doesn't know how to code :)
     
  13. kodagames

    kodagames

    Joined:
    Jul 8, 2009
    Posts:
    548
    Great question SamSam if you figure it out please let me know and I'll do the same.
     
  14. mikesgames

    mikesgames

    Joined:
    Apr 16, 2010
    Posts:
    1,071
    wow! thanks for this!
     
  15. groovfruit

    groovfruit

    Joined:
    Apr 26, 2010
    Posts:
    257
    What version of iTween does this work with, and can you use it for all platforms (and unity 1.7)?
     
  16. pixelplacement1

    pixelplacement1

    Joined:
    Aug 19, 2009
    Posts:
    674
    It's for iTween 2 and from what I've seen it looks like it only works (friendly) with Unity 3.
     
  17. PGstudio

    PGstudio

    Joined:
    Nov 1, 2010
    Posts:
    6
    Thanks for this awsome addition to iTween,
    but as Zeek , i still can't Play() an animation from my JS code.

    Let's say i have 3 tweensEditors in a given Object, how do i trigger each event individually via JavaScript ??

    Thanks a lot for your effort on this!.

    Cheers..
    PG
     
  18. defjr

    defjr

    Joined:
    Apr 27, 2009
    Posts:
    436
    Nice! Thanks.
     
  19. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
  20. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    SamSam, Zeek, PGstudio:

    Attached is an example of triggering a tween that is set to not play automatically via code. In this case, clicking on the sphere starts the tween on the box.

    In that example, if you had multiple tweens on your box and you wanted to trigger a specific one, you could use GetComponents instead of GetComponent and iterate through the iTweenEvent objects, checking the type property of each one until you find the one you want. That assumes you can distinguish between events via type. If you have multiple tweens of the same type that you want to trigger then we'd have to figure something else out. I suppose I could add a name variable to the iTweenEvent if people would find that useful.
     

    Attached Files:

  21. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    There's nothing in iTween that does this and I'm just putting an editor on top of what Bob's written, so unfortunately no there is no way to change textures via this tool. Glad you like it :)
     
  22. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    Unfortunately it has to be Unity 2 at least, I chose to use Unity 3 because of the nice Mono update (C# language features). I actually started the project in iPhone 1.6 and it was god awful, there is very limited custom editor functionality in that old code base, it was terrible. It could be made Unity 2 compatible but there's not much point in that now that Unity 3 is out, I'm sure the iPhone 1.7 would be of more use to you, sorry :(
     
  23. SamSam

    SamSam

    Joined:
    Aug 31, 2010
    Posts:
    44


    Thank you for the example, it's very kind of you.
    About adding a name variable to iTweenEvents that's seems to be a good solution that could make things more easy.
     
  24. SamSam

    SamSam

    Joined:
    Aug 31, 2010
    Posts:
    44
    Hey dkoontz,
    To have your js script example working in a scene of mine, i had to replicate your folder structure adding the "Plugins" folder and sorting files to match your setup.
    Shouldn't your iTweenVisualEditor.unitypackage file available to download been organised that way ?
     
  25. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    Well my structure was set up for C# developers which won't need the Plugins directory. I'll go ahead and make a note on the project page laying out how you need to set up your project for a Javascript project.

    You may run into this for future projects where you're mixing C# and JS, so the general rule is anything that you are calling from JS needs to be in the plugins directory.
     
  26. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Work fine in the editor on an iPhone build but throws this exception on the device itself. Can't find a file.


    FileNotFoundException: Could not load file or assembly '079571bfa3aba4d58a0ec845ebf51a5d' or one of its dependencies. The system cannot find the file specified.
    at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly) [0x00000] in <filename unknown>:0
    at System.AppDomain.Load (System.String assemblyString) [0x00000] in <filename unknown>:0
    at System.Reflection.Assembly.Load (System.String assemblyString) [0x00000] in <filename unknown>:0
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetDeserializationType (Int64 assemblyId, System.String className) [0x00000] in <filename unknown>:0
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadTypeMetadata (System.IO.BinaryReader reader, Boolean isRuntimeObject, Boolean hasTypeInfo) [0x00000] in <filename unknown>:0
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectInstance (System.IO.BinaryReader reader, Boolean isRuntimeObject, Boolean hasTypeInfo, System.Int64 objectId, System.Object value, System.Runtime.Serialization.SerializationInfo info) [0x00000] in <filename unknown>:0
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject (BinaryElement element, System.IO.BinaryReader reader, System.Int64 objectId, System.Object value, System.Runtime.Serialization.SerializationInfo info) [0x00000] in <filename unknown>:0
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject (BinaryElement element, System.IO.BinaryReader reader, System.Int64 objectId, System.Object value, System.Runtime.Serialization.SerializationInfo info) [0x00000] in <filename unknown>:0
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.IO.BinaryReader reader) [0x00000] in <filename unknown>:0
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object result, System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in <filename unknown>:0
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <filename unknown>:0
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in <filename unknown>:0
    at iTweenEvent.DeserializeValues () [0x00000] in <filename unknown>:0
    at iTweenEvent.get_Values () [0x00000] in <filename unknown>:0
    at iTweenEvent+<StartEvent>c__Iterator3.MoveNext () [0x00000] in <filename unknown>:0
     
  27. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    Did you get that error when building the XCode project or when running the app?
     
  28. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    I got this when I was running the app on the device in debugging mode.
     
  29. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    I've found a pretty obnoxious bug in Unity that is effecting the visual editor. If you experience your iTweenEvents getting wiped out and being reset to blank, then you are a victim of this. This occurs when you Unity recompiles code and will not properly update some GUID's and thus not be able to deserialize the iTween data. I have submitted the bug report to Unity and I'll see if I can find a workaround in the meantime, the ticket is here (http://intra.unity3d.com/fogbugz/default.asp?381151_s70ev3ht) if anyone feels like following along. Workaround suggestions are very much appreciated :)
     
  30. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    kenlem, I believe your error is related to the bug I found and just posted about.
     
  31. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Thanks. Honesty, I did see that I kept losing my settings in the editor. Just sort of thought I was doing something wrong. I'm working on a game now and would love to be able to use your editor. It's very helpful.
     
  32. spoke2018

    spoke2018

    Joined:
    Nov 7, 2010
    Posts:
    1
    I have the same problem than Kenlem on my pc , all objet with a component itween editor have this problem.

    and it was strange because all working very well during few hours and one time all are broken....

    on each itween editor component all are empty after this probleme.....






    FileNotFoundException: Could not load file or assembly 'e0566e45c553c9c4bb109a7da4e60f10' or one of its dependencies. The system cannot find the file specified.
    System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly)
    System.AppDomain.Load (System.String assemblyString)
    (wrapper remoting-invoke-with-check) System.AppDomain:Load (string)
    System.Reflection.Assembly.Load (System.String assemblyString)
    System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetDeserializationType (Int64 assemblyId, System.String className)
    System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadTypeMetadata (System.IO.BinaryReader reader, Boolean isRuntimeObject, Boolean hasTypeInfo)
    System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectInstance (System.IO.BinaryReader reader, Boolean isRuntimeObject, Boolean hasTypeInfo, System.Int64 objectId, System.Object value, System.Runtime.Serialization.SerializationInfo info)
    System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject (BinaryElement element, System.IO.BinaryReader reader, System.Int64 objectId, System.Object value, System.Runtime.Serialization.SerializationInfo info)
    System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject (BinaryElement element, System.IO.BinaryReader reader, System.Int64 objectId, System.Object value, System.Runtime.Serialization.SerializationInfo info)
    System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.IO.BinaryReader reader)
    System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object result, System.Runtime.Remoting.Messaging.Header[] headers)
    System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler)
    System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream)
    iTweenEvent.DeserializeValues () (at Assets/iTweenEditor/iTweenEvent.cs:358)
    iTweenEvent.get_Values () (at Assets/iTweenEditor/iTweenEvent.cs:77)
    iTweenEvent+<StartEvent>c__Iterator3.MoveNext () (at Assets/iTweenEditor/iTweenEvent.cs:121)
     
  33. Disati

    Disati

    Joined:
    Oct 5, 2009
    Posts:
    111
    Haven't tested it yet, but i already want to thank you, dkoontz, for sharing your great work.
     
  34. StephenL

    StephenL

    Joined:
    Oct 18, 2010
    Posts:
    218
    I get the same issues as the people above me. It all works great for awhile, and then bam! it spits out that error and everything disappears! But I hope this can get fixed asap, because I am using it in my project, and it is amazing! Thanks for all your work on it so far. :)
     
  35. shabazzster

    shabazzster

    Joined:
    Mar 17, 2010
    Posts:
    104
    Awesome Job! I know the bug will be worked out soon because this editor is a God Send Thanks Again!
    ~K
     
  36. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    A small update on my efforts to fix the binary deserialization bug. It appears I'm going to have to rewrite the serialization to completely avoid the binary serialization. I thought this was going to be easy, like a different class that takes the same data but saves it out as XML so I can store it as a string instead of a byte array. Oh, my naivety. So it looks like I have to rework all the serialization wrappers to play nice with XML serialization, sigh.
     
  37. box01

    box01

    Joined:
    Apr 2, 2009
    Posts:
    62
    Could you also add the name variables to the iTween event as well?( so one can easily accsess different iTween event) It would make this awesome script even more awesome.
     
  38. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    box01: yeah that's already in, along with a helper method to retrieve a named tween from a GameObject. That will be in my release that fixes this obnoxious bug.
     
  39. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Wait... do you really have to use XML? I'd like this to be able to run on the iPhone as well.
     
  40. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    I don't *have* to use XML, but I have to serialize in a way that doesn't use the BinaryFormatter class, which is the normal way of doing this. Do the XML serialization classes not exist on the iPhone version of Mono?
     
  41. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    I'm guessing the problems with iPhone and XML come from the deserialization doing runtime code generation which won't work on the iPhone Mono version? Is this still true in Unity 3 iPhone?
     
  42. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    I seem to recall some issue with XML and the iPhone but I'll check over in the iPhone forum.
     
  43. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    Ok, after a grueling fight with XML (which had to be abandoned due to iPhone compatibility issues), I have finally worked around the Unity bug. It's not the prettiest workaround but it's not a total hack either. A new Unity package has been uploaded to the usual spot so go snag it! I'm really interested to know if there are any more big lingering bugs I have not run into so keep the bug reports and feedback coming.

    As requested there was one enhancement in this version. A name field was added to the iTweenEvent so you can distinguish them. I also added a static method on the iTweenEvent class named GetEvent, you pass it the GameObject and name of the event you want to fetch and it will return it (or throw an exception if no event by that name can be found).
     
  44. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    I just added it to my project and ran a test scene on an iPhone without issue. I forced a recompile on the Unity side and didn't lose any settings. Seems to be working great. Thanks for fixing this. It's really useful.
     
  45. Westmark

    Westmark

    Joined:
    Nov 1, 2009
    Posts:
    187
    This is very cool :) tried it today, but found that it was easier to script the stuff i wanted using iTween only. but still a great tool :)
     
  46. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    What kind of stuff were you scripting that the visual editor was not good at? It's certainly not a be-all-end-all type tool, I'm just wondering if there are any obvious use cases that are missing.
     
  47. StephenL

    StephenL

    Joined:
    Oct 18, 2010
    Posts:
    218
    Yay! Thanks for fixing this so quickly! I love this tool and I am using in my project, and have no bugs so far, so I love you now. :D
     
  48. Westmark

    Westmark

    Joined:
    Nov 1, 2009
    Posts:
    187
    Might be me being dump :p but was trying to make a model bounce up from the ground when i entered a trigger box and bounce back down when i exited it :)
     
  49. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    You won't be able to do what you want using only the visual editor. I would suggest you update to the latest version (0.3) and then add 2 iTweenEvents to your GameObject, name them something like "jumpUp" and "jumpDown". Then in your OnTriggerEnter you can do iTweenEvent.GetEvent(yourGameObject, "jumpUp").Play(); Of course in OnTriggerExit you do the same thing but with "jumpDown".
     
  50. dkoontz

    dkoontz

    Joined:
    Aug 7, 2009
    Posts:
    198
    Glad to be of service.