1
Fork 0
mirror of https://github.com/Steffo99/beat-td.git synced 2024-11-27 17:34:18 +00:00
beat-td/Assets/Scripts/DepthFromY.cs
2018-04-22 18:40:31 +02:00

14 lines
346 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DepthFromY : MonoBehaviour {
private SpriteRenderer spriteRenderer;
void Update () {
spriteRenderer = gameObject.GetComponent<SpriteRenderer>();
spriteRenderer.sortingOrder = Mathf.CeilToInt(-transform.position.y * 100);
}
}