Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using UnityEngine;
- public class LinePlacer : MonoBehaviour //dont forget to add to namespace
- {
- [Serializable]
- public struct NeedFill
- {
- public Vector3 startPosition;
- public Vector3 endPosition;
- }
- public NeedFill[] positions;
- [SerializeField]
- private LineRenderer lineObject;
- private Transform firstLine;
- private void CreateLine()
- {
- for (int i = 0; i < positions.Length; i++)
- {
- var t = Instantiate(lineObject);
- t.SetPosition(0, positions[i].startPosition);
- t.SetPosition(1, positions[i].endPosition);
- if (i == 0)
- firstLine = t.transform;
- else
- t.transform.parent = firstLine;
- }
- firstLine = null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement