arcore-unity-sdk
arcore-unity-sdk copied to clipboard
Augmented Images: Not being able to add images runtime when using Instant Preview
SPECIFIC ISSUE ENCOUNTERED
Currently I can't add augmented images to the augmented images database. I currently wait until the session is tracking and then try to add the image so the augmented database located in the session config the following way:
session.SessionConfig.AugmentedImageDatabase.AddImage("TestImage", testTexture);
testTexture is a Texture2D that is the same as image 001 from the example. The texture has read/write enabled and uses RGB 24 bit for formatting.
I have tried the following things:
- Adding the images on an empty image database.
- Creating the image database myself with ScriptableObject.Instantiate and then adding the image to it.
- Waiting 5 seconds after the session is tracking and then adding the image.
None of the above work for me. I also made a new project, thinking that maybe I messed with some configurations, but I am able to recreate the problem.
Error:

VERSIONS USED
- Unity: 2018.3.0f2
- ARCore SDK for Unity: 1.6
- Device manufacturer, model, and O/S: Editor
- ARCore: 1.7.190128146
On Windows, use:
adb shell pm dump com.google.ar.core | findstr /i "packages: versionName"On macOS, use:adb shell pm dump com.google.ar.core | egrep -i versionName\|packages: - Output of
adb shell getprop ro.build.fingerprint: samsung/dreamltexx/dreamlte:8.0.0/R16NW/G950FXXS4CRLC:user/release-keys
STEPS TO REPRODUCE THE ISSUE
- Create a new project with the versions specified above
- Open the AugmentedImages example
- Open the ExampleController
- Add the following code with the other variables:
private bool addedNewDatabase; [SerializeField] private Texture2D testTexture;
- Add the following code in the update after the check for if the application is tracking.
if (!addedNewDatabase)
{
ARCoreSession session = FindObjectOfType<ARCoreSession>();
//session.SessionConfig.AugmentedImageDatabase = ScriptableObject.CreateInstance<AugmentedImageDatabase>();
session.SessionConfig.AugmentedImageDatabase.AddImage("TestImage", testTexture);
addedNewDatabase = true;
return;
}
- Add the 001 example texture to the inspector for the testTexture. Enable the write/read attribute and use the RGB 24 bit formatting. It will give another error otherwise
- Run the application, it will give an error in the editor window.
WORKAROUNDS (IF ANY)
ADDITIONAL COMMENTS
I am facing the same issue when i try to do it in editor, but it works well after building to an android device
Just tried to make this work again, but it seems like it isn't an Instant Preview only problem. I debugged the whole code while on the android mobile and it doesn't return anything from "nativeSession.AugmentedImageDatabaseApi.AddImageAtRuntime". It just gets stops in that function.
The image part of ARCore needs some attention...
Any update on this?
Did you got the soluiton for this problem ?