1
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Lightbug.CharacterControllerPro.Demo
|
||||
{
|
||||
|
||||
[RequireComponent(typeof(LineRenderer))]
|
||||
public class LineRendererUtility : MonoBehaviour
|
||||
{
|
||||
public Transform target = null;
|
||||
|
||||
LineRenderer lineRenderer = null;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
lineRenderer = GetComponent<LineRenderer>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
lineRenderer.positionCount = 2;
|
||||
lineRenderer.SetPositions(
|
||||
new Vector3[] {
|
||||
transform.position,
|
||||
target.position
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user