如标题中所述,统一代码看不到通过代码附加到其上的动画,而该动画又又被放入检查器中
我的播放器的BoxCollider2D
上打了IsTrigger
,因此它将取值并运行
我检查了动画中是否存在动画(已经在代码中),但他确切地说他看不到
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CrackedPlatformScript : MonoBehaviour
{
public AnimationClip destroyed;
private void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.tag == "Player")
{
if(destroyed != null)
{
GetComponent<Animation>().Play(destroyed.name);
gameObject.GetComponent<BoxCollider2D>().enabled = false;
Destroy(gameObject,0.4f);
}
else
{
Debug.Log(destroyed.name);
}
}
}
}