Create a script named UUIDManager.cs. Within the UUIDManager class, utilize a PhotonView to synchronize the UUID. In the AnchorItem class, when there's a need to share the UUID, call the relevant method from UUIDManager. The UUIDManager will then use Photon's RPC mechanism to send the UUID to other clients. Ensure that the UUIDManager class is attached to a GameObject in your scene and that this GameObject has a PhotonView component added to it.
When a player in the room performs cloud storage, it will be automatically shared with other players in the room.
publicasyncvoidCloudSave() {if (m_NRWorldAnchor !=null) {bool result=awaitNRWorldAnchorStore.Instance.CloudSaveAnchor(m_NRWorldAnchor);if (result) {NRDebugger.Info("Ready to share anchor: "+m_NRWorldAnchor.UUID);Debug.Log("Ready to share anchor: "+m_NRWorldAnchor.UUID);ShareUUID(); }else {Debug.LogError("Failed to save anchor"); } }else {Debug.LogError("m_NRWorldAnchor is null, failed to save this anchor to CloudStorage"); } }
Conclusion
Congratulations on completing this comprehensive guide on sharing anchors using Photon and Cloud Storage! You've taken significant steps in enhancing the multi-user AR experience. Thank you for dedicating your time and effort to this tutorial. Best of luck with your future AR projects!