Start a new topic

Using the Wikitude 8.5 new Image Targets At Runtime feature in Unity

Hi there,


I would like to try out the new runtime image target generation in Unity, but I cannot find neither documentation nor a sample for it. What are the steps to use this amazing new feature in my Unity app?


Hi, 


It's true that at the moment this feature is not properly documented. This will be addressed soon.


To use this new feature, you need to configure the TargetCollectionResource of the ImageTracker to point to the images you'd like to track. Please make sure to do this before the Start method of the ImageTracker is called by Unity. Here is an example:


public ImageTracker tracker;

/* Use Awake to make sure this is called before the ImageTracker.Start method is called by Unity */
private void Awake() {
    string pathToImage = "path/to/image.png";
    
    tracker.TargetCollectionResource.UseCustomURL = true; /* UseCustomURL specifies that the path is NOT relative to StreamingAssets */
    tracker.TargetCollectionResource.TargetPath = "file://" + pathToImage; /* Make sure to use file:// prefix to indicate that the file is local on the device */
}


Best regards,

Alexandru

Great, that works like a charm. Thank you very much. 


Is it also possibly to add more than one image to a traget collection that way?

Hi, 


It's not possible to add multiple images directly, but if you create a zip with all of them and pass the zip to the TargetCollectionResource, that should work as well.


Best regards,

Alexandru

Login or Signup to post a comment