Start a new topic
Solved

Wikitude + Unity ARFoundation + URP

Hello, 


I try to get the sample szene from Wikitude "Simple - Alignment Initialization" To work with the Universal Render Pipeline and ARfoundation. 


I try it with different Unity Version 

Unity 2020.2.2f1

Unity 2019.4.21f1

Unity 2019.4.2f1


and with Wikitude 9.6.0


the first step i try to get Wikitude with URP to work end i get every time the same error.

 

if i build it for Android i dont get a AR Background.


if i try to use the Window -> Wikitude - URP Helper 

i get this error: Packages\com.wikitude.core\Editor\Helpers\URPHelper.cs(11,29): error CS0234: The type or namespace name 'Universal' does not exist in the namespace 'UnityEngine.Rendering' (are you missing an assembly reference?)


also i try to make it manualy like here https://www.wikitude.com/external/doc/expertedition/UnitySupportedPackages.html#manual-scene-conversion


but nothing work i hope anyone can help me


with best regards

Mike



I attached a scene and the new script. Importing both with their meta files into the scene should hopefully work.


Kind regards,
Gökhan

zip
(17.3 KB)

1 person likes this

Hi,
Unfortunately, URP is currently only supported in the Expert Edition Unity SDK.


Kind regards,

Gökhan




1 person likes this

Second part: Make an URP ready Alignment Initializer sample scene ready for AR Foundation


Be sure to add the AR Foundation render feature to the URP render pipeline renderer asset (like described in the Unity documentation)

Afterwards, open the URP ready alignment initializer sample scene and follow these points:

  • Add an "AR Session" GameObject with the AR Session and AR Input Manager components to the scene hiearchy's root.
  • Add an "AR Session Origin" GameObject wit the AR Session Origin component to the scene's hierarchy.
  • Link the "Main Camera" GameObject to the AR Session Origin component's Camera field.
  • Set "Main Camera" GameObject's Camera component's Render Type back to "Base".
  • Add following components to the "Main Camera" GameObject:
    • Add the Tracked Pose Driver component and set its Update Type to "Update And Before Render"
    • Add the AR Camera Manager component
    • Add the AR Camera Background component
  • Parent the  "Alignment Initializer" GameObject to the "Main Camera" GameObject (That is important, for the snapping effect upon recognition to work properly.)
  • Add an "AR Foundation Plugin" GameObject with the AR Foundation Plugin component as a child to the "Wikitude SDK" GameObject.
  • Remove the "Device Camera" as well as the "Camera Frame Renderer" GameObjects.
  • Replace the AlignmentInteractionController.cs script with the one attached to this post. This script will eliminate the need for the secondary alignment camera (which's primary use case was for initial alignment in the Editor anyways).
  • Apply final settings to the "Wikitude SDK" GameObject:
    • Add the "Main Camera" GameObject to the AR Camera field.
    • Add the "AR Session Origin" GameObject  to the AR Origin field.
    • Change the AR Bridge type to "Plugin"

A refinement to the alignment initialization sample is planned and will also factor in improvements to better support for AR Foundation and URP.


Kind regards,
Gökhan

cs

Hey Gökhan,


thank you for the good support. 


The URP part works perfect. With The ARFoundation part i still have problems. If I do it like you described, the app crashes immediately after starting.


I installed the package "Android Logcat" to look in the consol what is happens. the Error was:


 2021.03.05 11:55:04.512 14180 14195 Error WKTD >Error: [com.wikitude.camera.android][00:00:00.115.670] > Could not start the camera because no activeCamera has been set. (code 1003)


i try to add the Device Camera GameObject + Comment back to the Wikitude SDK GameObject with that i can Build and interact with the app but i cant use the UI Elements.


with best regards

Mike

Because of the UI i found one error. 


as i replace the AlignmentInteractionController.cs Script the Buttons in Canvas / Safe Area Handler / Header / Alignment Switch Buttons (Activate Stop Sign Alignment Button and Activate Firetruck Alignment Button) lost 1 OnClick event 


the Button itself are deactived after build and the Loading idicator is to see so that i cant change the object what i want to track


with best regards

Mike

 

This error comes because the SDK initializes an internal Android camera.... but we want to use the frame given by AR Foundation. I just saw that I missed a step.

Added it retroactively to the previous post:


Apply final settings to the "Wikitude SDK" GameObject:

  • Add the "Main Camera" GameObject to the ARCamera field.
  • Add the "AR Session Origin" GameObject  to the AR Origin field.
  • Change the AR Bridge type to "Plugin"


Can you send me where the UI error occurs?


Kind regards,
Gökhan

ARCamera , Ar Origin and AR Bridge to Plugin is set.


the szene still only work if i had the Device Camera Component


with best regards

Mike 

But then it is not using the AR Foundation camera frame. Please delete the device camera and try if all AR Foundation settings are working as expected. You can also create a blank AR Foundation scene (without the Wikitude components) and see if it works.


Kind regards,
Gökhan

hmm 


if i delete device camera then i get the same error 

Could not start the camera because no activeCamera has been set. (code 1003)


in a new scene  only with AR Foundation i dont have problems 


with best regards

Mike

yes it works. 


i will compare the two scenes in the hope of finding the fault.


thank you so much 


with best regards

mike 

That's nice to hear! Feel free to share your scene file with me. Then I could also have a look and update the description accordingly for those who also need this setup...


Kind regards,

Gökhan

Sure here is what i had to make. The script is the one you sent me first, I just renamed it


with best regards

Mike

rar
(13.2 KB)

i found out that it must be because of the script.


because if i use the 2nd script you sent me (this with the scene) in the scene that didnt work before then it works too.


with best regards

mike

Glad that it works now, and thanks for the archive.


Kind regards,
Gökhan

Login or Signup to post a comment