This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
station_obscurum_unity/Assets/Scripts/DynamicLine.cs
2023-03-27 18:49:30 -04:00

38 lines
742 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteAlways]
[RequireComponent(typeof(LineRenderer))]
public class DynamicLine : MonoBehaviour
{
[SerializeField]
private float length = 5f;
[SerializeField]
private int count = 2;
private float pLength;
private int pCount;
private LineRenderer lineRenderer;
// Start is called before the first frame update
void Start()
{
lineRenderer= GetComponent<LineRenderer>();
}
// Update is called once per frame
void FixedUpdate()
{
if (pLength != length||pCount!=count)
{
lineRenderer.positionCount = count;
}
}
}