3 de jan. de 2020

iTween

I was looking for an easy way to move GameObjects around, and I found the iTween Asset.
  1. Import the Asset
  2. Insert the code in Class from the GameObject that you want to move.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Hashtable ht = new Hashtable();
ht.Add("x", transform.position.x);
ht.Add("y", transform.position.y + 1f);
ht.Add("time", 2);
ht.Add("oncomplete", "AnimationEnd");
ht.Add("oncompleteparams", sender);
ht.Add("easetype", iTween.EaseType.linear);
ht.Add("scale", new Vector3(1, 1, 1));
iTween.ScaleTo(panel, ht);
iTween.MoveTo(gameObject, ht); 


https://assetstore.unity.com/packages/tools/animation/itween-84
http://www.pixelplacement.com/itween/documentation.php

One problem happened using iTween inside a GameObject that animate another GameObject. The "oncomplete" was never called. I found the solution in this Post.

Nenhum comentário: