World Anchor code

Here, we will implement World Anchors. We will go through what we add line by line and learn what everything means. Just to set expectations, this next section is almost entirely code-based.

In our fields and properties area, we need to add the two lines that are at 11 and 12 in the picture below. Depending on how you have your own code written, these numbers may not line up exactly, but should be close; this screenshot shows you the code that surrounds it to give reference points:

In the first of the two lines, we are creating a string to give our anchor a name.

The second line will be used to get a reference to our WorldAnchorManager ...

Get HoloLens Beginner’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.