Search Unity

Problems running with Managed Stripping and DataPrivacyButton

Discussion in 'Unity Analytics' started by tessellation, May 13, 2021.

  1. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    390
    I'm attempting to change Managed Stripping level from Low to Medium. When the APK on Android is run, we get the following errors generated by our DataPrivacyButton object:

    The referenced script (UnityEngine.Analytics.DataPrivacyButton) on this Behaviour is missing!
    The referenced script on this Behaviour (Game Object 'Button - Data Privacy') is missing!
    A scripted object (probably UnityEngine.Analytics.DataPrivacyButton?) has a different serialization layout when loading. (Read 32 bytes but expected 364 bytes)
    Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?

    I'm using the latest Analytics Library package 3.2.3 and building with Unity 2018.4.33f1. This also happens with Unity 2020 LTS. It's very strange that these classes would be getting stripped if they are referenced from a scene's objects.
     
  2. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    390
  3. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We are not able to reproduce. Does it occur on a new project also? Please create a minimum repro project (generally not your game), remove the /Library folder and submit a bug report, and provide the bugID here. And speaking of the /Library folder, you might try to delete that in you project and reopen the project (make a back up first). This may properly generate the dependencies.
     
    Last edited: Jun 3, 2021
  4. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    390
    @JeffDUnity3D Thanks for checking on it. I was able to eliminate this error by adding a link.xml file in the Assets/Plugins folder. It seems as though Unity was stripping the class even though it's referenced by a component in an included scene.

    Code (JavaScript):
    1. <linker>
    2.   <assembly fullname="Unity.Analytics.DataPrivacy">
    3.     <type fullname="UnityEngine.Analytics.DataPrivacyButton"/>
    4.   </assembly>
    5. </linker>
    I did not try the Library deletion method, but I can. Is this something you recommend to everyone when the Managed Stripping level is changed?
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    No, it was suggested just as a test. I'm glad you found a work around.