Thank you Pharan,
yes I am quite new to C# and whats worse I am an artsit ;-) But well I do "fight" for some time with it and I know how to use Debug.Log. But in this case I don't understand what I should Log.
If I do Debut.Log(eyesClosedSlot);
it only gives me, well the string, which is not helpful. So how do I get the values with the debug.log command? And what values do I have to check?
15 Feb 2017, 12:04
Ok, I could fix it. I did not get any feedback from whatever I tried to get back from the debug.log command.
So, I checked back in Unity and figured out my Gameobject(character) does not have a skeletonAnimation!
But a skeletonAnimator.
Trying to add a skeletonAnimation additionaly didn't fix it, since I can only have one of them.
So I went back into the script and changed it to:
using System.Collections;
using UnityEngine;
using Spine.Unity;
public class randomeyeBlinkAnimation : MonoBehaviour {
[SpineSlot]
public string eyesSlot;
[SpineAttachment(currentSkinOnly: true, slotField: "eyesClosedSlot")]
public string eyesClosedAttachment;
[SpineAttachment(currentSkinOnly: true, slotField: "eyesClosedSlot")]
public string eyesOpenAttachment;
private SkeletonAnimator skeletonAnimator;
// Use this for initialization
void Start () {
skeletonAnimator = GetComponent<SkeletonAnimator> ();
StartCoroutine (Blink());
}
IEnumerator Blink()
{
while (true){
yield return new WaitForSeconds(Random.Range(0.2f, 3f));
skeletonAnimator.skeleton.SetAttachment (eyesSlot, eyesClosedAttachment);
yield return new WaitForSeconds (0.1f);
skeletonAnimator.skeleton.SetAttachment (eyesSlot, eyesOpenAttachment);
}
}
}
Now it does indeed work.
Awesome, now my eyes might stop hurting!!
What is the difference between the sekletonAnimation and the Animator?