Closed Zaitam closed 3 years ago
Fixed it by getting the Vertex Count and setting them to a list.
using System.Collections.Generic;
using UnityEngine;
using PathCreation;
public class pathCollider : MonoBehaviour
{
[SerializeField]private EdgeCollider2D _edgeCollider2D;
private List<Vector2> _list = new List<Vector2>();
private PathCreator _path;
private int _VertexCount;
private void Start()
{
_VertexCount = _path.path.NumPoints;
for (int i = 0; i < _VertexCount; i++)
{
_list.Add(_path.path.GetPoint(i));
}
_edgeCollider2D.SetPoints(_list);
}
}
Is there anyway to add a 2d box/edge collider that follows the path?