+13

Tween Options - DOTween

aYo 2 years ago updated by Alexander Vinogradov 2 months ago 57

This is my first forum post and (official) macro contribution. Hello World!

This collection of macros allows you to easily set the easing, loop type, delay, loops for your tween as well as giving you flow branches for OnStart, OnComplete, OnUpdate and the progress percentage of your tween.

  1. Tween Options - lets you set the easing, loop type, delay and loops 
  2. Tween Curve Ease - lets you set an Animation Curve as your ease
  3. Tween Callbacks - lets you start Flows for your tween's OnStart, OnComplete, OnUpdate. Since v1.1.1 TweenCallbacks now forces AutoKill to false so that the OnComplete triggers properly. You will have to Kill the tween after, if you no longer need it.
  4. Tween Full Options - this just combines Tween Options and Tween Callbacks, in case you need it all in one node


Download Latest v1.1.2 (should work with Bolt 1.4)

Download Latest v1.1.2 (alternative download location, discord cdn)

Download v1.1.1 (should work with Bolt 1.3)

Download v1.1.1 (should work with Bolt 1.2.3)

Download v1.1.0 (added Curve Ease)

Download v1.0.1 (added delay)

Download v1.0


Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
+1

Hi aspy,

Thanks for your contribution. This looks really useful. Since I never used DOTween, maybe you could give a short example how to use them?
Thanks a lot!

+2

Hi Ingo,

In order to use these, you must have DOTween properly set up, Bolt installed afterwards and in the Bolt setup(or build options) you have to select these(or just the ones you have/need):


after this is done, you can safely copy the macros and helper script to the project and be able to use them.

the shortcut extensions give you the DOMove, DOFade etc. and you can use them with my macros like so:


Hope this helps!

+1

Thanks a lot for your explanation. This helps a lot to understand! :)

+1

this stuff will probably be obsolete when Bolt 1.4 comes out, but until then, you have a bit more control over your tweens

btw, you can also use these with my other release, Sequence Tools

These look great! When I get to choosing the Type Options I can't access any of the Shortcut Extensions. I managed to add them ok at Assembly Options, but they aren't in the finder for Type. Am I looking in the wrong place? Thanks

what bolt version are you using? is this a new project? did you add dotween after you installed bolt?

Using Bolt 1.2.3. At first I added it afterwards as I had a project already running. But then I tried with a new clean project to see if it cleared the problem, adding and setting up dotween first before installing bolt. The same issue. Is there a workaround using scripts? I've only started on Bolt in the past few days, but I assume there's a way you could write some simple template scripts to create the DOTween units I need? 

yes, it can be done with scripts. you can look at the script coming with these Super Units, but this should not happen. I mean, it happened to me a number of times too, but i think its a bug. 

One weird fix i found was to copy dotween nodes from a project where these showed up, into to project where they didn't. nodes worked, just could add them from the FuzzyFinder.  i then added these nodes to SuperUnits which showed in the FuzzyFinder.

Also, try to update to 1.2.4 beta, as it's a lot faster

Thanks! So I created a clean project and added 1.2.4 and finally I got the extension options you recommended. Phew! So now I have two options: try to upgrade Bolt in my existing project to see if that fixes things (how do you do this btw? I tried adding it as a custom package but couldn't get it to replace the Bolt already installed). Or alternatively try your option of copying nodes. What did you mean by this? Turning them into Macros and then copying the files over between projects?

yes, getting those macros in the project where they don't show. This, or bug Lazlo about it, maybe he knows a better fix

another crazy thing that worked, was copying all the stuff from my old project into the duplicated project where the nodes show. but again, this is either a bolt or a dotween issue, it has nothing to do with my macros.

In the end I just reverted back to an earlier version of the project and installed the 1.2.4 Bolt as a clean build. That got everything working. I still can't get the Play, Play Backwards, and Duration sequence nodes to load, no matter what I try. Thanks for the macros

load in the finder? you added sequence to types?

Yes I added the sequence to types but no sequence play options show up in the finder. I added to your Sequence Tools script to create the Play and Play Backwards nodes. I couldn't figure out how to code the Duration node so I abandoned it. Any idea how? Also, the zip folder for your macros seems to mess them up a bit. There was a reflection failure in the Tween Options macro which I fixed pretty easily, and the Tween Options Full has some embed graphs which also cleaned up pretty easily. There's a reflection failure in the Tweens Set Curve Ease macro too - it can't find Set Curve Ease. I couldn't find it either. BUT what I have got working is really great - I really appreciate the work you've put in to make these so usable :)

+1

Just an FYI, the beta essentially fixes any problems permanently. Next stable release you should import other people's macros with accompanying scripts without a hitch. If there is errors, it'll stay connected until you fix them and resolve it. But I've had problems prior here too, importing everything at once. Like the macro loads before the script or something.

yeah, maybe it would be safer if you add all assemblies, types, you build the units and after this you copy in the TweenOptions macros

Ok. Good to know. Thanks

What do you mean by Duration Node?

In your Sequences macros, you mentioned (and showed in your screenshot) a Sequence Duration node, which I imagine checks for includeLoops. I can't figure out the logic of recreating this as a Bolt node. I got as far as floatOut = sequence.Duration(includeLoops); but that didn't work

if you search for Duration in the fuzzyFinder, you find nothing? I find the Tween Duration node, also, if I search for Sequence and go inside it, I can find a Duration Node greyed out. if i click it, poof, i got Sequence Duration node

Nope. Neither of those work for me. The closest I get is a Sequence > DO Time Scale node which is the only one with a Duration value (but no way of including loops). Hey ho...

I believe you. Same for me.

Hodo, you have Sequence > selected there, can you not enter it? If you enter, does it not show a Duration node somewhere in there? Even if grayed out?

so you don't see this?

I don't see half the things you see...

You've got Plugins and DO Virtual at the top level. Did you add other assemblies or types in the Unit Options Wizard?

yeah, you can try adding other types from DG until they show up

did you figure this out in the end?

No, I just worked around it. I'm still on 1.2.3 but might try to upgrade in a week (I tried before but Unity kept crashing on generating inspectors). One thing I'm struggling to figure out is why the animations sometimes overshoot. Eg I have a DO Move X that should move from x=10 to x=8 but ends up at x=7.90144 Is this something you've come across before?

I had same problem with Play/PlayBackwards not showing up in the Sequence "folder", but after adding DO Tween to Types and rebuilding, they popped up.
i haven't had this problem with overshooting destination value, but maybe it's a problem with the object's pivot or anchor?

you are unlucky. try to add more dotween types to your Unit Options? like Tween Params, Tween Extensions,DO Tween etc

Can you try to make a new project where you add all of the dotween types, before you bring any extra macros?

I'm trying to create sample movement of a box. On mouse button down it is tweening ok 2 units up but i've also added "Set Position" command after that tween (when tween is finished it should then set position back to 0) but for some reason sequence reach only Super Unit. What i'm doing wrong? When i test it i see there progress dots going through first 2 white connection at the same time.

Hi. The onComplete is really hacky solution, if you look inside TweenCallbacks you will see that there's a Greater Than Or Equal Node, set at 0.95f. Because your duration is small, it probably doesn't get to that point, so try lowering that value, until it works. I did this hack because of the default behaviour of DoTween when it comes to how tweens are handled after they finish, the default is to kill the tween. Because of this i never get the Elapsed Percentage node to give me the 1f, therefore i used the 0.95f. You could also try to disable the default auto-kill, but that will affect all your tweens.

If you're using Bolt 1.3 beta, i've just updated the package to no longer use the hacky OnComplete, but instead force AutoKill to false and trigger OnComplete on 1f progress. if you're still on 1.2.3, you can either wait for me to do this tomorrow, or overwrite the .cs file with the one from this archive, and add the SetAutoKill to the beginning of the TweenCallbacks SuperUnit(before the play check) and change the Greater Than to 1f instead of 0.95f

+1

i've just added download link for 1.2.3

+1

I didn't see "tween" and "tweener" in "type options". Everything else has....

I can not see them either. @aYo is it only for the Pro version of the DO Tween?

no, they are in the free version, anything that needs pro says pro in the name. what bolt version do you have?

did you try to add them by clicking DG > Tween/Tweener or by search?

+1

Bolt version 1.4.0f4, .NET 3

I tried with both ways on that project with fuzzy finder and going manually through that menu but couldn't find them.

But I created now a whole new project; only Bolt in addition to DOTween and now those can be found with fuzzy finder with no problems. Not sure why that is even possible. Maybe there were some conflicts then :/ (there were no errors in console though)

updated the macros to work with Bolt 1.4.
New download link added!

updated Assemblies and Types:


+1

updated Assemblies and Types for latest DOTween:


Hi aYo, I've managed to use your extensions, making Super Unit for Tween Full Options work but I get this error


InvalidOperationException: Port 'enter' on 'WaitForSecondsUnit#64557...' can only be triggered in a coroutine.
Bolt.Flow.InvokeDelegate (Bolt.ControlInput input)

Do you know what I'm missing?

The tween callbacks always stops at the Wait node, never continues to the end, that's why the callbacks on Tween Full Options never works

Hi, sorry for the late reply. i don't check the forum much, you can find me on the discord faster.
Can you try setting the original event that leads to the macro to be set as coroutine?

Just encountered this problem as well (don't know if it was resolved previously)
Setting the Update to coroutine as well fixes it (just below the circled Wait above) 

could you give me a screenshot for this? thanks for the help!

After doing this I encountered another bug though.
But unsure if its caused by using co-routine, or if its more of just how Bolt handles things:

The macro would reach the point where it sets running=True,
But I'm guessing Bolt assumes Update is useless so kills the process?? so the last value that Branch got from Get Variable would be running=False (even though the very next value would be true if checked for) so isComplete never gets checked.

Finally got around it by rewriting the whole thing (super non-generic sadly) and having it all run on an external Update (with Once to simulate the tween creation) 

i cannot stress this enough, apparently. if you want a fast response from me, please find me on the Bolt Discord server. i rarely check this place

Didn't need a fast response though? Been posting here after already resolving or finding workaround solutions. Didn't think I could help troubleshoot the bug(?) further either as I'd made a mess of saving over stuff repeatedly (the above portion was written from memory, as I'd overwritten it by then) so thought it'd be more useful here where other users might be able to riff off of it at a later date.

If you actually do want to follow up its @Vong, but again, didn't need a response really, fast or otherwise, for this issue.

Sorry about that. i had a lot of stress in that period and your comment just added to the stress, as i saw it 4 days after you wrote it, soo it was just another thing i was late to respond to :P

+1

it seems DOTween structure has changed since the last time i used it
Type Options window should include all the modules you are interested in using.
I added all modules in my Type Options:

I can not find the Tween type. I'm using not Pro version.


Also, could you show an example of killing Tween it seems to be not working:

I start a tween OnStateEnter

The OnStateExit I want to kill it using DOTween.Kill() by the target. The target is correct but it seems to have no tweens on it but I'm still seeing it move. I tried to debug it by getting a list of tweens by target object but it gives null as well.