Fatal error with Canvas and child object

Hi,

I tried to build a basic scene with nothing more than a canvas in it, just like in the project provided by @joejo in this thread: Correct setup for Unity UI - #7 by joejo.

However, when I build a project with a canvas and any UI element as child, I’ll get a fatal error when Xcode tries to launch the app in simulator:

[Platform] Entity -2147483648:19091238 not found
PolySpatialRealityKit/PolySpatialImplUtils.swift:52: Fatal error: Entity -2147483648:19091238 not found

As soon as I remove the child object, the same app without any additional changes will launch as expected.

I have the same issue in our existing project we’re porting to visionOS.

Are there any additional settings to be aware of regarding UI and PolySpatial?

What version of the PolySpatial plugin are you using? What version of Unity?

I’m using Unity 2022.3.11 and PolySpatial 0.5.0

I’ve never seen this error at all, not even with way more complex canvas hierarchies than what you are describing. Can you post a simple sample repro that I can look at?

I’ll prepare a sample project tomorrow (I’m in Central European Timezone) and keep you updated!

We are also seeing this error, I posted about it here - Simulator crash after adding UI elements

I’ve been testing extensively the last two days and can not for the life of me repro this issue. Any other details you feel may be relevant?

I tried to create a sample project for you today, but I didn’t manage to reproduce the error a clean Project. Even my test project didn’t threw the Error. I worked on another machine though and might have uncommited changes at the office.

I was able to reproduce the error in our game though, seems like there is a combination of stuff that leads to this. I’ll keep digging into since we really want to use the canvas.

I get this error in Xcode when trying to run a canvas with a child in our main project.

Maybe this helps.

I spent a few more hours debugging this. I noticed that a scene that works perfectly in a clean project, doesn’t in our game. So I started comparing the project settings, but still no luck after making sure they are the same.

What I found out however, is that the fatal error occurs as soon as e.g. an Image component is attached to a game object. Removing it will let the project start in simulator, no fatal error thrown.

Similar behaviour on a default button. Removing the image and TMP-Text child will let the project start without any errors.

Is there something that comes onto your mind that could cause this issue @joejo? The game was ported from 2021.3.30 to 2022.3.11(now 12) when we started working on the visionOS port.

Well, buttons and TMP don’t have Image components on them AFAIK. Buttons get their image from an assigned image in the Button component and TMP only uses the font atlas image. Neither of these have been issues that I am aware of, at least not like this.

If what you are talking about is the assigned images then I am wondering if it has something to do with the images/textures that you are using?

We tracked it down to the Raycast Target setting on the image component. As soon as we set it to false, the project will launch as expected. Setting in back to true will lead to the fatal error during the start process. In out test case we are using only default Unity components, no sprites or anything.

I can reproduce this with the Raycast Target setting on a TMP-Text as well.

Can you tell us what happens at PolySpatialRealityKit/PolySpatialImplUtils.swift:52 so we can further investigate what the difference between our and other projects is?

1 Like

It’s just the fatal error message log and throw. We’d need more stack trace than that to go on.

And just to add more info, we use Raycast Target enabled for the samples and other projects and have not seen this, though this is definitely good information.

Hey there. I’m working with KevHell on our project for visionOS. I have picked this up again today, hoping the issue will go away in PolySpatial 0.6.2, but sadly it’s still there. I made a screengrab of the stacktrace in Xcode. Maybe this helps. If there is any other, better, way to export the stacktrace from Xcode, do let me know!

Well what that is telling me is that the RK side is failing to find an entity in the RK scene graph that the sim side thinks exists. Unfortunately there isn’t much more I can tell you without some sort of repro I can work with.

Are there any scripts on your objects or running in the background that could be altering game object activation or creation?

@mml and I reduced our project to a single scene, threw out all game related stuff and reproduced the bug in a project you can find here.

The project should start without any problems. If you set Raycast Target to true on the image (as shown below), Xcode will throw the fatal error while starting the app.
image

We’re using Unity 2022.3.12f1 and PolySpatial 0.6.2 and can reproduce this reliably.

1 Like

Thank you. Will try to take a look today and see what can be determined.

So I haven’t run this yet, but the first thing I notice is that your project is using an out of date version of com.unity.xr.visionos. You should upgrade that package to the same version as the polyspatial packages.

Can confirm that this does crash OOB when starting in simulator. Thank you for this repro project. We’ll get on this right away.