Routing to WebXR component

Hello again, I am building out my react app and have set up the routing to the different pages, however, when the page routes to the Web AR component (which I have tested that it works) it shows the needle engine load screen yet doesn’t show my scene. I am wondering if there is any suggestions that you have for how to get the routing to work to the Needle component? I know this is more of a react question but I’ve figured everything out besides the routes to the Web AR component.

Original Post on Discord

by user 580207235171614720

Hey :wave: whats your exact structure and what is the “Web AR component”? Do you refer to a scene that uses AR as the Web AR Component?

Is it a iframe with the whole export or do you render your own needle-engine element?

But mainly, do you see any console errors while you are stuck on the loading screen?

I am using the react-router-dom

by user 580207235171614720

Browser router to route to the different pages.

by user 580207235171614720

The WebAR component that I was refering to is a component which holds the needle engine component and will display AR experiences

by user 580207235171614720

i see, a react component, not a unity/needle component :+1:

And I am not getting any errors but there are warnings from WebGL that there is an invalid operation in readPixels

by user 580207235171614720

Yeah

by user 580207235171614720

That is sadly there most of the time, it is quite misleading when something doesn’t work. (there’s an open issue on fixing that)

It should communicate on what’s wrong. Such as if a .glb/.gltf isn’t supplied or if a script causes a runtime error and crashing the runtime. (Which could be where the router changes some context or a path)

But you say that everything works fine without the router and that with it, it just hangs on the loading screen without any errors, right?

Yeah that’s exactly right. I can also see the scripts that I have written for unity running in the console, it is just the scene not rendering so I am not sure what is causing the issue. I will be trying work arounds today but if there is any suggestions of things to try please let me know.

by user 580207235171614720

oh that’s a very important note, so it seemingly loads and runs, but the outpit is stale.

Can you confirm that update is running every frame?

Also what version are you on?

I got it to work, thanks for all the help!

by user 580207235171614720

I changed the routing so that it renders the needle engine component instead of the routes when in a specific url

by user 580207235171614720

Glad that you were able to resolve that :cactus: Although, your use case should be more straight forward, thank you for the feedback :slight_smile:

Do you think you could send us a bug report with the version that didnt work as expected? I’m curious as to why. You can use our builtin bugreporter for that to attach the project and the required files for the currently open scene