Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by CirseiHyuga · Nov 17, 2017 at 08:46 AM · webglassetbundlexmlil2cppstripping

Asset Bundle code stripping / link.xml not working

Hello,

I'm currently working on a project for WebGL build, working with assets bundle. When I make my build for WebGL I get the following errors :

Error on mozzilla :

 An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
 uncaught exception: abort(70) at jsStackTrace (VisionneuseWebGL.asm.framework.unityweb:1218:12)
 stackTrace (VisionneuseWebGL.asm.framework.unityweb:1232:11)
 abort (VisionneuseWebGL.asm.framework.unityweb:453801:43)
 nullFunc_vii (VisionneuseWebGL.asm.framework.unityweb:28536:2)
 b70 (blob:2955384:1)
 mftCall_vii (blob:2851775:1)
 __ZL15CloneObjectImplP6ObjectP9TransformR10vector_mapIiiNSt3__24lessIiEE13stl_allocatorINS4_4pairIiiEEL18MemLabelIdentifier1ELi16EEE (blob:758505:1)
 __Z17InstantiateObjectR6ObjectRK8Vector3fRK11Quaternionf (blob:1871450:1)
 __Z54Object_CUSTOM_INTERNAL_CALL_Internal_InstantiateSingleP12Il2CppObjectRK8Vector3fRK11Quaternionf (blob:2549506:1)
 ce6e49761d2c31df7859c6e83cd6c075 [UnityLoader.ce6e49761d2c31df7859c6e83cd6c075/asm.__Z54Object_CUSTOM_INTERNAL_CALL_Internal_InstantiateSingleP12Il2CppObjectRK8Vector3fRK11Quaternionf] (VisionneuseWebGL.asm.framework.unityweb:347924:9)
 ftCall_iiii (blob:4941:10)
 mftCall_iiii (blob:505295:9)
 _Object_INTERNAL_CALL_Internal_InstantiateSingle_m937318366 (blob:483688:9)
 _Object_Internal_InstantiateSingle_m152726869 (blob:419824:9)
 _Object_Instantiate_m3128801945 (blob:220306:8)
 _Object_Instantiate_TisRuntimeObject_m1589467547_gshared (blob:254355:7)
 _U3CInstantiateFromABU3Ec__Iterator2_MoveNext_m2663907703 (blob:155266:4)
 mftCall_iii (blob:518890:64)
 __ZN21InterfaceFuncInvoker0IbE6InvokeEjP11Il2CppClassP12Il2CppObject (blob:268908:9)
 _SetupCoroutine_InvokeMoveNext_m3687002044 (blob:366448:21)
 mftCall_viiii (blob:496403:3)
 __Z53RuntimeInvoker_Void_t105822878_RuntimeObject_IntPtr_tPFvvEPK10MethodInfoPvPS4_ (blob:506753:2)
 mftCall_iiiii (blob:495126:64)
 __ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException (blob:482326:9)
 _il2cpp_runtime_invoke (blob:491439:9)
 _il2cpp_runtime_invoke [asm._il2cpp_runtime_invoke] (blob:671712:10)
 _il2cpp_runtime_invoke (VisionneuseWebGL.asm.framework.unityweb:11642:9)
 __Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb (blob:2696456:1)
 __ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb (blob:2083494:1)
 __ZN9Coroutine14InvokeMoveNextEP21ScriptingExceptionPtr (blob:2308276:1)
 __ZN9Coroutine3RunEPb (blob:2393165:1)
 __ZN9Coroutine17ContinueCoroutineEP6ObjectPv (blob:2797523:1)
 mftCall_iii (blob:2849661:1)
 __ZN14AsyncOperation15InvokeCoroutineEv (blob:1827720:1)
 __ZN14PreloadManager26UpdatePreloadingSingleStepENS_21UpdatePreloadingFlagsEi (blob:1298697:1)
 __ZN14PreloadManager16UpdatePreloadingEv (blob:1714158:1)
 __ZZ23InitPlayerLoopCallbacksvEN38EarlyUpdateUpdatePreloadingRegistrator7ForwardEv (blob:2459690:1)
 mftCall_v (blob:2888261:1)
 __Z10PlayerLoopv (blob:810392:1)
 __ZL8MainLoopv (blob:2135425:1)
 ce6e49761d2c31df7859c6e83cd6c075 [UnityLoader.ce6e49761d2c31df7859c6e83cd6c075/asm.__ZL8MainLoopv] (VisionneuseWebGL.asm.framework.unityweb:208994:9)
 ftCall_v (VisionneuseWebGL.asm.framework.unityweb:30706:9)
 browserIterationFunc (VisionneuseWebGL.asm.framework.unityweb:11460:4)
 runIter (VisionneuseWebGL.asm.framework.unityweb:10858:5)
 Browser_mainLoop_runner (VisionneuseWebGL.asm.framework.unityweb:11498:3)

Error on my profiler (I couldn't copy/paste it easily):

 Could not produce class with ID 111 and 74. This could be caused by a class being stripped by the build even though it is needed. Try disabling 'Strip Engine Code' in player settings.
 

So I wrote a link.xml file to exclude some classe being stripped and I put it into my assets repository. But it didn't change anything...

 <linker>
 <assembly fullname="UnityEngine">
 <type fullname="UnityEngine.Animation" preserve="all"/>
 <type fullname="UnityEngine.AnimationClip" preserve="all"/>
 </assembly>
 </linker>
 

So, does anyone know why link.xml seems to have no effect ? Is there another proper way to exclude some class of stripping process ?

Thank you for reading this, hope someone will be able to help ;)

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by JoshPeterson · Nov 30, 2017 at 01:28 PM

The link.xml file only impacts stripping of managed code, In this case, it looks like native engine code that is used only in your asset bundle (and not in any scene in the build) is being removed. That is why link.xml won't help.

You have three options.

  1. Like the error message says, you can disable engine code stripping in the Player Settings. This will increase the size of the build, but you won't have to worry about what you use in asset bundles.

  2. You can create a dummy scene in the build which uses the engine code types that are used in your asset bundles. That way they won't be removed by engine code stripping. Based on the error message, it seems you need to keep AnimationClip (class ID 74) and Animation (class ID 111).

  3. You can use a custom build configuration to tell the build process what engine code types the asset bundles you will load use. The build process will keep them around for you. See the asset bundle demo project for an example, specifically this code: https://bitbucket.org/Unity-Technologies/assetbundledemo/src/464697bcff9b5422e13950b9a9664cd0b3496d10/demo/Assets/AssetBundleManager/Editor/BuildScript.cs?at=default&fileviewer=file-view-default#BuildScript.cs-122

Comment
Add comment · Show 9 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CirseiHyuga · Dec 01, 2017 at 11:57 AM 0
Share

Thanks for the answer ! Indeed I created that dummy scene to solve the problem and it works. However I would prefer the third otion, even if it seems pretty hard to accomplish...

avatar image JoshPeterson CirseiHyuga · Dec 01, 2017 at 12:44 PM 0
Share

The third option is best in the long run. It offers the best flexibility vs size tradeoff. I think it is worth implementing.

avatar image a_tarerra · Jan 31, 2018 at 04:15 PM 0
Share

Is option 3 working in 5.6? I've set the correct path in "assetBundle$$anonymous$$anifestPath" in my build options, but when I load the scene, I still get "Could not produce class with ID ...". I've triple checked I've got the correct path, but there's nothing in the editor log to indicate whether or not "assetBundle$$anonymous$$anifestPath" was taken into account during the build, as far as I can see. $$anonymous$$y second question is, how much do we actually save by enabling engine code stripping?

avatar image JoshPeterson a_tarerra · Jan 31, 2018 at 04:19 PM 0
Share

I've not heard any other reports of this not working in 5.6. However you might be hitting a bug that has not yet been reported. If you think that is the case, please file a bug report.

how much do we actually save by enabling engine code stripping?

This is rather project-specific. It might be worth trying a build with option 1 (disable engine code stripping) and compare the build size.

avatar image a_tarerra JoshPeterson · Jan 31, 2018 at 05:00 PM 0
Share

I tried to set the wrong path in "assetBundle$$anonymous$$anifestPath" and noticed I got additional class ID errors. Not sure where that leaves me, but it does seem like the manifest is taken into account, then. $$anonymous$$y scene asset bundles do have dependencies to other asset bundles in the manifest, but that should be supported, right? Thanks for the tip, I'll compare build sizes:)

Show more comments
avatar image Don-Tako · Apr 03, 2018 at 06:52 PM 0
Share
  1. Put a link.xml file in Assets Folder and specify code types. https://pastebin.com/G$$anonymous$$dg17Cz and voilá

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

81 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Errors encountered with WebGL 1 Answer

Error parsing XML string with attributes usign XMLDocument when built on WebGL 0 Answers

Can't build WebGL because of IL2CPP crash 4 Answers

Loading game objects dinamycaly 1 Answer

WebGL tring AssetBundle Demo Project remotely 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges