public class Update_OrderInLayer_Moving : MonoBehaviour {
private SpriteRenderer spriteRend;
private Transform trans;
void Start(){
spriteRend = GetComponent<SpriteRenderer> ();
trans = GetComponent<Transform> ();
spriteRend.sortingOrder = (int)(trans.position.y * -1000);
}
void Update(){
spriteRend.sortingOrder = (int)(trans.position.y * -1000);
}
}
unity 2D游戏实时检测渲染层级
最新推荐文章于 2024-04-09 20:04:21 发布