I’ve recently updated to Unity 6 (6000.0.25f1). Unfortunately it seems that I’m no longer able to load UXML files from Asset Bundles when using IL2CPP. This only happens if the UXML file contains a ListView element. I get this error message:
Unknown managed type referenced: UnityEngine.UIElementsModule UnityEngine.UIElements.ListView/UxmlSerializedData
Should not occur! Internal logic error
If I switch to Mono, I can successfully load the UXML file from the bundle. Creating a ListView from code also works (Mono and IL2CPP).
The ListView in the UXML file is empty, it only contains a few margin settings.
I don’t know if this is a UI Toolkit thing or rather an IL2CPP thing… but is there anything I could do to avoid this error?
It’s probably due to code stripping that’s done as part of the build process.
You could change how aggressively code is stripped, but fixing the root cause would be making sure that all your used types / members of types are marked as required one way or another.
link.xml files are one mechanism to tell Unity what will be stripped. If you can build all your bundles before a build, you can generate link.xml files based off the output of that bundle build process and add them to the project temporarily to help the project build process know that there are types/members that are not among what’s referenced by the project but are required. Addressables does this when building its bundles. There would be an issue if you started referencing previously unreferenced managed types/members in newly built bundles when you don’t also build a new player, since the existing player wouldn’t know about these types that had been stripped at that point.
Reducing the managed code stripping level could help with that by keeping more types around, but the binaries will be larger.
Detail regarding this here:
Oh, thanks a lot! Managed stripping level was already set to “Disabled” (although IL2CPP notes that it can’t be fully disabled), but adding the UxmlSerializedData type to the link.xml did the trick!

Hi,
Could you please file a bug report so we can make sure UxmlSerializedData is not stripped?