Does Unity have an equivalent to the Actions feature/functionality of cocos2D and Sprite Kit; if so, what is it?

cocos2D Actions: http://python.cocos2d.org/doc/programming_guide/actions.html http://www.cocos2d-x.org/wiki/Actions

Sprite Kit Actions: https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/AddingActionstoSprites/AddingActionstoSprites.html

  • \$\begingroup\$ It would help here if you clarified what functionality you're actually trying to accomplish. Depending on what use of "Actions" you want to find an analogue for, the Unity equivalent might be Coroutines, Delegates, interpolation helper functions, etc. Can you edit your question to include an example use case you'd like to translate into a Unity-style solution? \$\endgroup\$
    – DMGregory
    Jun 26, 2016 at 12:19

2 Answers 2


You might like DOTween, which is a tween engine for Unity and a successor to HOTWeen.
It's said to be a lot faster than iTween, another tween engine for Unity. I also find it easier to use too.

I suggest you check out the documentation page. It has easing like you mentioned, among other many useful features like Sequences and callbacks. It's obvious from looking at the documentation page, but it can tween many objects, including UGUI ones.

I'm using it for my 2D game project for school to animate UGUI objects, so the features that I find particularly useful are the ones listed under "Unity UI 4.6 shortcuts" under "B. The shortcuts way" on the documentation page.
But again, you can use it to animate things like Camera, Material, Rigidbody, TrailRenderer etc etc...

About easing, DOTween's easing options include sine, quadratic, cubic, elastic and many more.

  • \$\begingroup\$ If you take away the comment about tweens and the link to tweens, are the things you're suggesting the same as Actions in cocos2D? \$\endgroup\$
    – Confused
    Feb 20, 2016 at 15:51
  • \$\begingroup\$ edit. I took it out. It was distracting from the question. \$\endgroup\$
    – Confused
    Feb 20, 2016 at 15:52
  • \$\begingroup\$ Further, the question was about Unity. Not Unity plugins and assets. \$\endgroup\$
    – Confused
    Feb 20, 2016 at 15:54
  • \$\begingroup\$ @Confused I do admit my experience with cocos2d is limited, but I think tweening(animating by translating, scaling, rotating, etc...) is precisely what cocos2d action's equivalent would be, although the plugin I suggested doesn't have something like CCTwirl and CCLiquid in cocos2d. \$\endgroup\$
    – James0124
    Feb 20, 2016 at 15:58
  • \$\begingroup\$ @Confused Oh, if you limit the scope to Unity's built-in features, I don't think there is something like cocos2d's action features. \$\endgroup\$
    – James0124
    Feb 20, 2016 at 16:03

Does Unity have an equivalent to "Actions"?

That depends entirely on your interpretation of what "Actions" do, and of course, your base requirements.

Let's take a look at an example of an "Action", as provided by the Cocos2d-x Wiki:

// Move sprite to position 50,10 in 2 seconds.
auto moveTo = MoveTo::create(2, Vec2(50, 10));

// Move sprite 20 points to right in 2 seconds
auto moveBy = MoveBy::create(2, Vec2(20,0));

From what the documentation infers, MoveTo is an action that has been built to direct any object to a position. In this case, you appear to be creating a delegate function, which your object then stores reference to and runs.

Let's take a look at an example of how you would implement this same "Action" in Unity:

float speed = 10; 
Vector2 targetPosition = new Vector2(50, 10);
Vector2 newPosition = Vector2.MoveTowards(transform.position, targetPosition, speed);
transform.position = newPosition;

You will immediately note that in Unity, you are writing the "action", yourself. As such, you should have an understanding of either Java or C#. This might seem a little more difficult than the "pre-baked Actions" of Cocos2d-x, but this is often desirable; you should still ideally only have to write the action once, and you have access to a lot of powerful functions provided by the UnityEngine namespace (alone - there are many other namespaces under the UnityEngine namespace). Furthermore, you can make it behave exactly how you want it to. For example, you would be able to edit the above script to interpret speed as speed * Time.deltaTime. This is especially useful, in this context; we need to scale our speed to the delta time of the update functions, to ensure the speed stays the same across a variation of setups and processor speed.

Does Unity implement "Sprite Kit Actions"?

The same rules apply.

You can still manipulate various attributes associated with the sprite, whether that be direct values on the sprite itself to change things such as transition style and speed, or changing values on the game object that holds the sprite.

These "actions" would simply be methods you have written that manipulate these areas. You can also create variables on the animations, themselves, which can be directly manipulated with built-in functions.

Ultimately, it is difficult to say if Unity has "Actions", as it is hard to infer exactly what you want from the "Actions". That said, if you assume programming capability, you certainly have the ability to set the mechanic up on your own.

Than again, you may not want to. As stated previously, the example appears to show "Actions" being used as delegates. Unity typically expects you to call "actions" as standard functions (MoveTo::create() versus Move()). You might find that with time, you take to using the Unity method; delegates are considered more advanced, though you do not appear to be given the same type of control you would expect from advanced technique.

It is important to note that regardless, you are going to have to do some programming. Unity runs off Unityscript (a variation of Javascript) and C#, where Cocos2d-x runs off C++. You will find similarities, but you will not get absolute control by assuming C++ context. Regardless, the Unity website offers excellent tutorials, and provided you put in the effort, it will not be difficult to use code in Unity by comparison.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .