Search Unity

How to prevent stripping OcclusionCullingData type when using IL2CPP?

Discussion in 'Scripting' started by Kichang-Kim, Aug 28, 2019.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,011
    Hi. I found that when I used OcclusionCulling only scenes in AssetBundle, it shows "Could not produce class with ID 363" error in player build. After investigating, class ID 363 means "OcclusionCullingData" type.

    How to prevent IL2CPP stripping for that type?

    I tried this link.xml but not works:
    (I used reflection and UnityType class for getting above information. It's module name is "Umbra" and namespace is empty.)

    Any ideas?
    Thanks.
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    The link.xml file won't work in this case. It is used to preserve managed code, but OcclusionCulling is a native code engine type.

    I think that you have two options:
    1. Disable "Strip Engine Code" in the player settings. This will cause your build size to be larger, but should eliminate this issue.
    2. Use a custom build process to inform the Unity editor about the native engine code types used in your asset bundles. You can see an example of how to do this here: https://bitbucket.org/Unity-Technol...BundleManager/Editor/BuildScript.cs#lines-122
     
    Kichang-Kim likes this.
  3. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,011
    It seems that both 1 and 2 are not suitable for my case. My project is composite of two separated parts (client only build and assetbundle only build).

    I found that adding very small scene (1 renderer + OC) to client can solve this issue.
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    That works as well!