Hi,
I am facing a problem with initializing Animation objects inside a loop in C#. The code is as follows. BasicAnim is a custom Animation object. For one animation, which works :
_appearAnimations[0] = new BasicAnim<Vector3>();
_appearAnimations[0].duration = duration;
word = word_list[1];
_appearAnimations[0].AddTarget(val => word.transform.position = val);
_appearAnimations[0].easingFunc = AUBasicAnim.EaseNone;
_appearAnimations[0].fromValue = p1_list[1];
_appearAnimations[0].toValue = p2_list[1];
_appearAnimations[0].AddListener(this);
But when i loop them, it does nt work.
for (int i = 0; i < word_list.Count; i++)
{
_appearAnimations *= new BasicAnim();*
appearAnimations*.duration = duration;
word = word_list;
_appearAnimations.AddTarget(val => word.transform.position = val);
_appearAnimations.easingFunc = AUBasicAnim.EaseNone;
_appearAnimations.fromValue = p1_list;
_appearAnimations.toValue = p2_list;
_appearAnimations.AddListener(this);*
* }*
I call the _appearAnimations.play in a loop later and only the last animation plays. I am new with C# so am unsure what could go wrong here. Any help is appreciated.
Thanks,
O_