Draw a Line to AR World- App Dev Series 18

Objective: quick intro of LineRenderer in Unity.

LineRenderer is a component that would let your drawing lines in Unity.
In this tutorial, we would take a quick demonstrate of how to draw a line from UI to 3D object that on a AR scanning target.


To draw a line using LineRenderer, you need to have the Vector3 data from both target object. Let’s get the Vector3 on the UI target and 3D object.

Create a new UI Canvas and change the render mode to “Screen Space- Camera”. Then assign the AR camera to it.

Inside this Canvas, create an image object with a text object in it. This is the label that would be connected to 3D object by LineRenderer.

Then create a sphere on 3D model. You can see it as a label mark would pop up the information column.


Now we got all the objects we needed. Add a LineRenderer component in label object.

Add a script in Label object to draw the line object.
Inside the script, get the reference of LineRenderer and Label. Once we get the reference, we need to set the width of line on both dots.

Then we can draw a line in Update().

And don’t forget to attach the LineRenderer and sphere object in editor.

Now would be a good time to open your camera and test it out!




A passionate gamer whose goal is to work in video game development.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Breath-First-Search on Trees

OFAC Checker: A Cloud Maven, Inc.’s app for instant OFAC checking

Important Pandas Libraries for Data Engineering — Part 2

The Kubernetes documentary!

Installing Precompiled-Pytorch in OctoPi(Custom RBP Image)

Here Is What We Need to Learn From the World’s Largest All Remote Company

Microservices Interview Questions

Domain Mapping in GCP

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

Mobile Applications In Unity: Rainy Day Insurance — Anchor Points and Preserve Aspect Ratio

Cross-Platform Mobile Game Development [Ultimate Guide for 2022]

Creating Main Menu for App

[Closed] Korean Pop Culture Fan Three.js Programmer