Using the Unity editor, you can create AR Contents that can later be added to a CraftARItem as a GameObject. There are two ways this can be done programmatically:
- From a prefab: Create an instance of a GameObject stored in a prefab and attach it to your CraftARItem.
- From an asset bundle: Download the bundle from the Internet and attach it to your CraftARItem.
Create an empty CraftARItem
In order to create contents that we want to add to a CraftARItem, we first need to create an empty CraftARItem:
A window pops up. Set the name and reference image for this CraftARItem. Select an image from your project. This image should have at least 288 pixels in its shortest side.
Once created, a new scene edition window appears. You can design here the Augmented Reality scene that will appear when this reference image is recognized in your app.
Add a game object
Use GameObjects to design your Augmented Reality scene. Create a GameObject and drag it into your CraftARItem. All contents of your AR scene (game objects, lights, etc.) must be placed inside your CraftARItem in the hierarchy.
Publish into CraftAR service or embed into your app
Now your item is ready to be published. Open the CraftAR Item Editor (go to CraftAR > Open CraftAR Item Editor) and select your CraftARItem. In the CraftAR Item Editor, you can see an overview of your CraftARItem.
In order to show AR contents in your Unity app, you need to publish the CraftARItem into the CraftAR service in the cloud. For the AR contents you have two options:
- Upload the content into the Media Library of the CraftAR service:
- Save the content as a prefab and embed it into your Unity app.
In order to upload the content, you just need to check the corresponding Asset Bundles. Note that this will require a Unity Pro Android and Unity Pro iOS licenses. In order to save the content, check the option Copy to Resources. This option will make a copy in the Resources folder. Note that this does not need any Unity Pro license.
Finally, select the collection where you want to upload your new CraftARItem, and press ‘Publish New Item’. Your item will be uploaded and published to the CraftAR service and will be ready to use in less than a minute. If you have not yet introduced an API Key, log into your CraftAR account and go to Manage API Access. The API Key is provided in the Management API section.
Managing published items
If you want to delete any of the items published from the CraftAR Unity plugin, you have to do it through your account in the CraftAR web panel (https://my.craftar.net). If you need to modify the contents of any of your published items, go the the web panel, completely remove the corresponding item, and publish the updated version from the Unity editor following the steps described before.