at the moment I try to use the experimental WorldAnchorManager (see official API entry) of MRTK 2.4. Over all everything looks quiet easy. First of all, you have to create an Instance of the Manager and assign it to the script where you want to use it. Afterwards, it should be possible to load an anchor into a object with this piece of code:
public string AttachAnchor(GameObject gameObjectToAnchor, string anchorName = null)
This code also saves the Anchor as mentioned in the API.
If I want to remove the anchor from a GameObject I can call:
public void RemoveAnchor(GameObject gameObjectToUnanchor)
In my Unity-Project (2019.3.7) I calculate a position of some gameobjects and afterwards assign them Anchors via the Method above. If I move the Gameobjects, I remove the anchors and attatch them again after the moving process is finished.
If I deploy the solution on HoloLens2, position the gameobjects, attatch the anchors and get a log that the anchors have been attatched successfully, those anchors should be accessable on hololens2 locally across sessions. Unfortunately, in my case after restarting the application on the device and reloading the anchors, they cant be loaded. The Manager Logs "Anchor could not be loaded for 'GO name' ... creating a new anchor".
I am not sure what I did wrong, should this Manager already work? Do I have to Configure something in the Unity-Project to use the Manager? Maybe someone already uses the Manager and can help me with this issue.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…