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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.