Trying to add and load different gameobject to the anchor

Include the following details (edit as applicable):

  • Issue category: VPS
  • Device type & OS version: PC ARDK EXAMPLE MOCK
  • Host machine & OS version: PC ARDK EXAMPLE MOCK
  • Issue Environment : PC ARDK EXAMPLE MOCK
  • Xcode version:
  • ARDK version:latest
  • Unity version:2021.3.6f1

Description of the issue: I try to save the game object that place to that anchor and when I load the anchor, I want to have the game object that I place earlier.

private void CreateAnchorGameObjects(IWayspotAnchor[] wayspotAnchors)
           wayspotAnchor.TrackingStateUpdated += HandleWayspotAnchorTrackingUpdated;
            var id = wayspotAnchor.ID;
            var anchor = Instantiate(OHcontroller.ObjectHolder);
            var existedID = gameData_List.my_second_game_list.Select(a => a.guid);


Basically ARDK now only saves the anchor information to the JSON file, and what game object to spawn on that anchor is not saved. Because CreateAnchorGameOjbects have been used to create a new anchor with an object and load an anchor with a game object. However, as I mentioned above, the script only saves the anchor location, so what to spawn in that position is always gonna be the prefab you place. Which limit to one single game object in every place.
Currently, I open a new list to save the spawned game object name, and the Guid into a list, trying to change the prefab back to the original game object that I placed. However, I’m kinda stuck, since there is no way to save the game object to JSON file so my option is left to change the game object base on the name. Any suggestion that I can load the anchor with a different game object?

Hello Sin Hang Kan,

You can look at the WayspotAnchorDataUtility class for guidance on saving and loading data, as this is where you could tell the code to associate certain wayspot anchor ID’s with certain game objects. However, we currently don’t support adding custom information to WayspotAnchorsData, so this is something that developers would need to implement on their own.

Please be sure to check our Roadmap periodically for updates about future functionalities. Thank you!