У нас вы можете посмотреть бесплатно Drawing in UNITY in 60 SECONDS или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
Link to my game: https://play.google.com/store/apps/de... In this 1 minute tutorial you will learn how to implement line drawing, using c# and unity. Sub to the channel for more usable content that does not waist your precious time. The code: using UnityEngine; public class Draw : MonoBehaviour { public Camera m_camera; public GameObject brush; LineRenderer currentLineRenderer; Vector2 lastPos; private void Update() { Drawing(); } void Drawing() { if (Input.GetKeyDown(KeyCode.Mouse0)) { CreateBrush(); } else if (Input.GetKey(KeyCode.Mouse0)) { PointToMousePos(); } else { currentLineRenderer = null; } } void CreateBrush() { GameObject brushInstance = Instantiate(brush); currentLineRenderer = brushInstance.GetComponent type_here_angle_brackets LineRenderer type_here_angle_brackets(); //because you gotta have 2 points to start a line renderer, Vector2 mousePos = m_camera.ScreenToWorldPoint(Input.mousePosition); currentLineRenderer.SetPosition(0, mousePos); currentLineRenderer.SetPosition(1, mousePos); } void AddAPoint(Vector2 pointPos) { currentLineRenderer.positionCount++; int positionIndex = currentLineRenderer.positionCount - 1; currentLineRenderer.SetPosition(positionIndex, pointPos); } void PointToMousePos() { Vector2 mousePos = m_camera.ScreenToWorldPoint(Input.mousePosition); if (lastPos != mousePos) { AddAPoint(mousePos); lastPos = mousePos; } } }