Is there an example for handling everything at runtime that works with Unity 5.3? I am asking as I have issues making things work. I have simply created the Adventure Platformer Pack player as a spritesheeted project (File->"Generate spritesheets for project images" and selected "save spritesheeted project") and copied that to my assets. Unity creates the prefab as expected, but that's where things come to a grinding halt.
if(spriterAnimator == null)
{
spriterBehaviour = player.gameObject.GetComponentInChildren<SpriterDotNetBehaviour>();
spriterAnimator = spriterBehaviour.Animator;
spriterAnimator.EventTriggered += e => Debug.Log("Event Triggered. Source: " + spriterAnimator.CurrentAnimation.Name + ". Value: " + e);
foreach(string key in spriterAnimator.GetAnimations())
Debug.Log("spriterAnimator.GetAnimations: " + key);
spriterAnimator.Speed = 1.0f;
spriterAnimator.Play("walk");
}
The code above seems to work, as in it produces valid objects and creates a debug output list of all animations, but nothing is ever rendered and an exception is thrown for every frame update:
ArgumentNullException: Argument cannot be null.
Parameter name: key
System.Collections.Generic.Dictionary`2[UnityEngine.Sprite,System.Collections.Generic.KeyValuePair`2[System.Int32,System.Int32]].ContainsKey (UnityEngine.Sprite key) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:458)
SpriterDotNet.SpriterAnimator`2[TSprite,TSound].GetSprite (SpriterDotNet.SpriterObject obj)
SpriterDotNet.SpriterAnimator`2[TSprite,TSound].Animate (Single deltaTime)
SpriterDotNetUnity.UnitySpriterAnimator.Animate (Single deltaTime) (at Assets/SpriterDotNet/UnitySpriterAnimator.cs:44)
SpriterDotNet.SpriterAnimator`2[TSprite,TSound].Step (Single deltaTime)
SpriterDotNetUnity.SpriterDotNetBehaviour.Update () (at Assets/SpriterDotNet/SpriterDotNetBehaviour.cs:72)
I am certain I am doing things wrong, just not sure how or where ... Any help or pointers are much appreciated!