"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Instant target is getting generated in Unity editor, but giving error in Android

I am taking a screenshot of the screen and converting it into a texture and directly creating an instant target using the following code ->

var tex1 = ScreenCapture.CaptureScreenshotAsTexture();

var observerBehaviour = VuforiaBehaviour.Instance.ObserverFactory.CreateImageTarget(tex1, 1, "help");

observerBehaviour.gameObject.AddComponent<DefaultObserverEventHandler>();

Instantiate(videoPlane, observerBehaviour.transform);

The code works fine and creates a target in editor but gives the following errors in Android

2022-05-13 15:45:08.700 31980 32259 Error Unity ObserverNotCreatedException`1: Failed to create ImageTargetObserver: INTERNAL.

2022-05-13 15:45:08.700 31980 32259 Error Unity   at Vuforia.Internal.Core.ObserverFactory.<CreateImageTargetObserver>g__CreateAndConfigureObserver|16_0 (Vuforia.Internal.Core.ObserverFactory+<>c__DisplayClass16_0& ) [0x00000] in <00000000000000000000000000000000>:0

2022-05-13 15:45:08.700 31980 32259 Error Unity   at Vuforia.Internal.Core.ObserverFactory.CreateImageTargetObserver (System.IntPtr texturePointer, System.Int32 textureWidth, System.Int32 textureHeight, UnityEngine.TextureFormat format, System.Single widthInMeters, System.String targetName, System.Nullable`1[T] motionHint) [0x00000] in <00000000000000000000000000000000>:0

2022-05-13 15:45:08.700 31980 32259 Error Unity   at Vuforia.Internal.Core.ObserverFactory.CreateImageTargetObserver (UnityEngine.Texture2D texture, System.Single widthInMeters, System.String targetName, System.Nullable`1[T] motionHint) [0x00000] in <00000000000000000000000000000000>:0

2022-05-13 15:45:08.700 31980 32259 Error Unity   at Vuforia.ObserverFactory.CreateImageTarget (UnityEngine.Texture2D texture, System.Single widthInMeters, System.String targetName) [0x00000] in <00000000

Hey there,

 

I'll try to reproduce the issue and see if I get the same errors.

Thanks for highlighting!

 

Kind regards,

Patrick Scheper

Technical Community Manager