Learn how to add code to your Unity project while getting data from the cloud.
Now that you are able to successfully stream the 3D model into Unity, it's time to make some custom adjustments.
Each hologram will be instantiated with a script named CustomBehaviour.cs attached. You can edit this script to create any behavior you would like while referencing additional data streamed from the cloud.
Open the Assets/echo3D/CustomBehaviour.cs script:
/// EXAMPLE BEHAVIOUR
/// Queries the database and names the object based on the result.
// Use this for initialization
// Add RemoteTransformations script to object and set its entry
Built-in keywords will be suggested through a drop-down list but you can addany key and any value by typing it in the text input field.
Run Unity again and notice that the game object name automatically changes.
Great work! 🎉
You can add metadata to the cloud or update existing metadata stored remotely by calling the UpdateEntryData function located in the echo3D.cs script. This function implements the Post Metadata to an Entry API query.
In order to call this function from any other script you can find the echo3D game object and use the echo3D.cs script instance to call the UpdateEntryData function with this single line of code: