1
Fork 0
mirror of https://github.com/Steffo99/beat-td.git synced 2024-11-23 15:54:18 +00:00
beat-td/Assets/Scripts/DepthFromY.cs

15 lines
346 B
C#
Raw Permalink Normal View History

2018-04-22 13:02:46 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DepthFromY : MonoBehaviour {
private SpriteRenderer spriteRenderer;
2018-04-22 16:40:31 +00:00
void Update () {
2018-04-22 13:02:46 +00:00
spriteRenderer = gameObject.GetComponent<SpriteRenderer>();
spriteRenderer.sortingOrder = Mathf.CeilToInt(-transform.position.y * 100);
}
2018-04-22 16:40:31 +00:00
2018-04-22 13:02:46 +00:00
}