Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

How could we delete all the anchors inside the room on the server(clear the room)?

evzyukevzyuk
edited July 2017 in Questions And Answers

How could we delete all the anchors inside the room on the server(clear the room) when it's connected to the server (SharingService)?
When we try to import the anchor from the room all the anchors are uploaded (WorldAnchorTransferBatch.ImportAsync). It's just wasting of time. I need just one anchor. How can I clear the room of the anchors or send the request to get the particular anchor?

Answers

  • ReeleyReeley ✭✭✭
    edited July 2017

    Either you only export that one specific anchor or you search in your imported anchorbatch for this one specific anchor and only instantiate that one

  • evzyukevzyuk
    edited July 2017

    @Reeley said:
    Either you only export that one specific anchor or you search in your imported anchorbatch for this one specific anchor and only instantiate that one

    The WorldAnchorTransferBatch imports all anchors from the room. You can not specify a specific anchor.

  • ReeleyReeley ✭✭✭

    Indeed but you can specify which anchor you want to add to your scene

    foreach (string id in batchLoaded.GetAllIds())
                {
                    if(id == "specificObject")
                    {
                        GameObject go = Instantiate(new GameObject());
                        batchLoaded.LockObject(id, go);
                    }
                }
    
  • @Reeley said:
    Indeed but you can specify which anchor you want to add to your scene

    foreach (string id in batchLoaded.GetAllIds())
                {
                    if(id == "specificObject")
                    {
                        GameObject go = Instantiate(new GameObject());
                        batchLoaded.LockObject(id, go);
                    }
                }
    

    Yes, I know that.
    But download 20-40 anchors too long. That's why I want to clean it when I connect to the room.

  • ReeleyReeley ✭✭✭

    Well the only option you have then is to only export the anchors you want

  • evzyukevzyuk
    edited July 2017

    @Reeley said:
    Well the only option you have then is to only export the anchors you want

    I'm telling you:
    I use(export) different anchors for each session and the same room.
    After a while there are many anchors in the room. I need to get rid of them.

  • ReeleyReeley ✭✭✭

    Are you using the WorldAnchorManager? if so you can remove anchors like this:

    WorldAnchorManager.Instance.RemoveAnchor(gameobject);

    If you want to delete all anchors, there is a function:

    WorldAnchorManager.Instance.RemoveAllAnchors();

  • @Reeley said:
    Are you using the WorldAnchorManager? if so you can remove anchors like this:

    WorldAnchorManager.Instance.RemoveAnchor(gameobject);

    If you want to delete all anchors, there is a function:

    WorldAnchorManager.Instance.RemoveAllAnchors();

    It removes anchors from the local store, but not from the server.

  • ReeleyReeley ✭✭✭
    edited July 2017

    Ohhhh now i see. I never fiddled around with Hololens and "multiplayer". I guess you are doing your networking with UNet? if so then you have to send some message to your server and execute the code there.

    EDIT:

    something like this:

    [Command]
        void CmdDeleteAnchorsOnServer()
        {
            WorldAnchorManager.Instance.RemoveAllAnchors();
        }
    

    EDIT2:

    are you using this? then i guess the server side has nothing to do with unity

  • @Reeley said:
    EDIT2:

    are you using this? then i guess the server side has nothing to do with unity

    You can also try. But I do not think that will work.

Sign In or Register to comment.