Daily progress: Creating the callout & UI.

Esteban Ibarra
3 min readOct 24, 2021

--

A callout is a label that draws a line to a point on the 3d model. We’ll create one by first making a sphere and placing it inside the horse where we want the end of the line to be.

Set up a new Canvas

Another canvas is created with the name Screen_UI, screenspace camera and we drag the VR camera into it. Next for scaling we scale with screensize, 1920x1080 for the resolution.

Making the label

Create an empty and name it “Callout_Holder” or “Label_Holder” or anything similar. Inside, create a new UI image and use the rect tool to stretch it out a bit and name it “Label”. create a text element inside with the text ‘My Label’. adjust the size and overflow options accordingly. Also attach a LineRenderer element to the label.

The lineRenderer has many options to control with, size, etc. We’ll be controlling these via a script. Speaking of which, we’ll also create a script called CalloutLabel and attach it to the Callout_Holder.

We’ll create holders for the line, the target, and the label and we’ll drag the label into the line and label slots, and the sphere into the targetObj slot.

We need to define the start and ending widths of the line, we want it to be super thin, so 0.01f will do nicely. Then in the update, we constantly set the start and end position of the line (0,1) to be the label and the target sphere we placed inside of the horse.

And with everything set up, we now have a beautiful purple line attaching our label to the horse!

Next, we’ll want to only show the label and line when the anim state is showing muscles, or anim 1.

In order to make things a little easier, we’ll make the UIManager a singleton. I won’t go over how to do that here, but there’s a quick article that’ll teach you how.

we’ll check to see if UIManager’s instance of currentAnim is 1, if it is, we’ll turn on the line and label, and if not, turn them off. Easy Peasy!

--

--

Esteban Ibarra
Esteban Ibarra

Written by Esteban Ibarra

cartoonist, game artist, and wanabe gamedev.

No responses yet