Does Unity have an equivalent to the Actions feature/functionality of cocos2D and Sprite Kit; if so, what is it?
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
TrailRenderer etc etc...
About easing, DOTween's easing options include sine, quadratic, cubic, elastic and many more.
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)); mySprite1->runAction(moveTo); // Move sprite 20 points to right in 2 seconds auto moveBy = MoveBy::create(2, Vec2(20,0)); mySprite2->runAction(moveTo);
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 * 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 (
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.