Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Engine Code Stripping and Packages

Discussion in 'Package Manager' started by MakinStuffLookGood, Oct 24, 2018.

  1. MakinStuffLookGood

    MakinStuffLookGood

    Joined:
    Nov 20, 2012
    Posts:
    21
    I've encountered something that was a little unexpected and couldn't find any documentation on it with packman so I figured I'd post about it here. Using the SpriteShapes package, I have a prefab shipped in an AssetBundle (using the new Addressables) which references the SpriteShape component. In an IL2CPP build for iOS, this object came in blank and I noted the Missing Behaviour warning in the XCode logs.

    Adding the package to a link.xml file seems to resolve the issue:

    <linker>
    <assembly fullname="Unity.2D.SpriteShape.Runtime" preserve="all"/>
    <assembly fullname="Unity.2D.Common.Runtime" preserve="all"/>
    </linker>


    While this makes sense in retrospect (the component is only referenced on an object included in the StreamingAssets folder), it was a weird case and not obvious from the documentation. The official docs do mention that package components can be stripped, but only in regards to disabled components and packages.
     
  2. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    435
    You are right, it could be made clearer in the docs. Code stripping is IIRC is done across regardless if it's a package or user code.