Resolved
I'm programming a game with a partner, he's using Spine to animate (cause I'm a terrible artist).
Anyways, we have a character that has multiple animations, left and right facing. (2D Platformer)
I can get the Right-facing animations to work until we swap left. Then NONE of the right animations show up in-game.
It'll switch between the left animations still,
and in unity the Skeleton Animation script will recognize the changes. They just aren't rendering.
Any ideas?
Code example:
using UnityEngine;
using System.Collections;
public class Anthony : MonoBehaviour {
public float speed;
public GameObject playerCamera;
[SpineAnimation]
public string idleRightAnimation;
[SpineAnimation]
public string idleLeftAnimation;
[SpineAnimation]
public string walkRightAnimation;
[SpineAnimation]
public string walkLeftAnimation;
[SpineAnimation]
public string hookRightAnimation;
[SpineAnimation]
public string hookLeftAnimation;
[SpineAnimation]
public string touchRightAnimation;
[SpineAnimation]
public string touchLeftAnimation;
public static bool action;
private SkeletonAnimation skeletonAnimation;
private string walking;
private GameObject actionObject;
private float actionDelayTime;
void Start () {
skeletonAnimation = GetComponent<SkeletonAnimation> ();
walking = "right";
action = false;
actionDelayTime = 0f;
}
void Update () {
if (actionDelayTime != 0) {
actionDelayTime
---
;
}
if (Input.GetKey (KeyCode.Space) && actionDelayTime <=0) {
actionDelayTime = 180;
if (walking == "right") {
skeletonAnimation.AnimationName = touchRightAnimation;
} else {
skeletonAnimation.AnimationName = touchLeftAnimation;
}
action = true;
} else {
action = false;
if (Input.GetKey (KeyCode.LeftArrow)) {
walking = "left";
transform.position += Vector3.left * speed * Time.deltaTime;
skeletonAnimation.AnimationName = walkLeftAnimation;
transform.eulerAngles = new Vector3(0, 0, 0);
}else if (Input.GetKey (KeyCode.RightArrow)) {
walking = "right";
transform.position += Vector3.right * speed * Time.deltaTime;
skeletonAnimation.AnimationName = walkRightAnimation;
transform.eulerAngles = new Vector3(0, 0, 0);
} else {
if (walking == "right"){
skeletonAnimation.AnimationName = idleRightAnimation;
} else {
skeletonAnimation.AnimationName = idleLeftAnimation;
}
}
if (Input.GetKey (KeyCode.UpArrow)) {
transform.position += Vector3.up * speed * Time.deltaTime;
}
if (Input.GetKey (KeyCode.DownArrow)) {
transform.position += Vector3.down * speed * Time.deltaTime;
}
float newY;
if (transform.position.y > 0) {
newY = Mathf.Clamp (transform.position.y, 4.3f, 6.78f);
} else {
newY = Mathf.Clamp (transform.position.y, -7.2f, -4.6f);
}