google-ar / arcore-unity-sdk

ARCore SDK for Unity
https://developers.google.com/ar
Other
1.4k stars 402 forks source link

Augmented Images: Not being able to add images runtime when using Instant Preview #517

Open patrickdemooij9 opened 5 years ago

patrickdemooij9 commented 5 years ago

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:

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: image

VERSIONS USED

STEPS TO REPRODUCE THE ISSUE

  1. Create a new project with the versions specified above
  2. Open the AugmentedImages example
  3. Open the ExampleController
  4. Add the following code with the other variables:

private bool addedNewDatabase; [SerializeField] private Texture2D testTexture;

  1. 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;
            }
  1. 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
  2. Run the application, it will give an error in the editor window.

WORKAROUNDS (IF ANY)

ADDITIONAL COMMENTS

EngMetwally commented 5 years ago

I am facing the same issue when i try to do it in editor, but it works well after building to an android device

patrickdemooij9 commented 5 years ago

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.

vjleo commented 5 years ago

The image part of ARCore needs some attention...

v-octal commented 5 years ago

Any update on this?

janeshvar commented 4 years ago

Did you got the soluiton for this problem ?