I need to draw a line between two points that supports sorting layers. How do I do it?
Attach this script to a GameObject with a LineRenderer component. Set up the LineRenderer as usual.
using UnityEngine;
using System.Collections;
public class LineRendererSorting : MonoBehaviour {
public string layerName = "YourLayerName";
public int order = 0;
void Start () {
LineRenderer lr = GetComponent<LineRenderer>();
lr.sortingLayerName = layerName ;
lr.sortingOrder = order;
}
}