loodakrawa / SpriterDotNet

A pure C# Spriter implementation
zlib License
220 stars 75 forks source link

Example please #124

Open AP2020C opened 2 years ago

AP2020C commented 2 years ago

Since the Unity (2021.3) example gives an error I try to import the other package, and it seems to work, only I can't figure out how to switch from one animation to the other: it only runs me the first one automatically, and if I try to use animator.Transition("_ATTACK", 2); I get error.

Error: NullReferenceException: Object reference not set to an instance of an object MyClass.Attack () (at Assets/1/MyClass.cs:24) UnityEngine.Events.InvokableCall.Invoke () (at <823fb226a3f9439cb41fdcb61f9c86a1>:0) UnityEngine.Events.UnityEvent.Invoke () (at <823fb226a3f9439cb41fdcb61f9c86a1>:0) UnityEngine.UI.Button.Press () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:70) UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:114) UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:57) UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:272) UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:501) `

AP2020C commented 2 years ago

Why was a new class created rather than using Unity's animators that have extensive documentation?