elcoldtown

Untitled

Aug 6th, 2020
590
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5.  
  6. public class LineRenderer : MonoBehaviour
  7. {
  8.     Vector3 startPos;
  9.     Vector3 endPos;
  10.  
  11.     public LineRenderer lr;
  12.     public AnimationCurve animation;
  13.  
  14.     Camera camera;
  15.  
  16.     // Start is called before the first frame update
  17.     void Start()
  18.     {
  19.         camera = Camera.main;
  20.         lr.enabled = false;
  21.  
  22.     }
  23.  
  24.     // Update is called once per frame
  25.     void Update()
  26.     {
  27.         if (Input.GetMouseButtonDown(0))
  28.         {
  29.             if (!lr.enabled)
  30.             {
  31.                 lr.enabled = true;
  32.             }
  33.  
  34.             lr.positionCount = 2;
  35.             startPos = camera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 8f));
  36.  
  37.         }
  38.  
  39.         if (Input.GetMouseButton(0))
  40.         {
  41.  
  42.         }
  43.  
  44.         if (Input.GetMouseButtonUp(0))
  45.         {
  46.             if (lr.enabled)
  47.             {
  48.                 lr.enabled = false;
  49.             }
  50.         }
  51.     }
  52. }
  53.  
Advertisement
Add Comment
Please, Sign In to add comment