spine-unity-docs
spine-unity-docs copied to clipboard
OnValidate: unassigned components
http://en.esotericsoftware.com/spine-unity-events
In the HandleEventWithAudioExample values aren't assigned to anything.
void OnValidate () {
if (skeletonAnimation == null) GetComponent<SkeletonAnimation>();
if (audioSource == null) GetComponent<AudioSource>();
}
It should be:
void OnValidate() {
if (skeletonAnimation == null) skeletonAnimation = GetComponent<SkeletonAnimation>();
if (audioSource == null) audioSource = GetComponent<AudioSource>();
}
I've made this mistake many times before.