Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class LineRenderer : MonoBehaviour
- {
- Vector3 startPos;
- Vector3 endPos;
- public LineRenderer lr;
- public AnimationCurve animation;
- Camera camera;
- // Start is called before the first frame update
- void Start()
- {
- camera = Camera.main;
- lr.enabled = false;
- }
- // Update is called once per frame
- void Update()
- {
- if (Input.GetMouseButtonDown(0))
- {
- if (!lr.enabled)
- {
- lr.enabled = true;
- }
- lr.positionCount = 2;
- startPos = camera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 8f));
- }
- if (Input.GetMouseButton(0))
- {
- }
- if (Input.GetMouseButtonUp(0))
- {
- if (lr.enabled)
- {
- lr.enabled = false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment