MRTK y la extracción de código administradoMRTK and managed code stripping

Cuando se usa el back-end de scripting IL2CPP de Unity (opcional en Unity 2018.4, obligatorio en 2019 y versiones posteriores), se produce la extracción de código administrado.When using Unity's IL2CPP scripting backend (optional in Unity 2018.4, required in 2019 and newer), managed code stripping occurs. El vinculador de Unity realiza este proceso para reducir el tamaño binario, así como para reducir los tiempos de compilación.Unity's linker performs this process to reduce binary size as well as to decrease build times.

El Mixed Reality Toolkit usa un archivo, , para influir en cómo el vinculador de link.xml Unity procesa ensamblados MRTK.The Mixed Reality Toolkit uses a file, link.xml, to influence how Unity's linker processes MRTK assemblies. Este archivo, descrito en su totalidad en la documentación de Unity,proporciona al vinculador instrucciones sobre cómo conservar el código cuando no se puede inferir su uso (por ejemplo, se usa a través de la reflexión).This file, described in full in Unity's documentation, provides the linker with instructions on how to preserve code when its usage cannot be inferred (ex: used via reflection).

Como plataforma flexible y personalizable, MRTK crea el archivo en durante la importación, si se encuentra link.xml Assets/MixedRealityToolkit.Generated que no existe.As a flexible and customizable platform, MRTK creates the link.xml file in Assets/MixedRealityToolkit.Generated on import, if it is found to not exist. Los archivos de link.xml existentes no se sobrescriben.Pre-existing link.xml files are not overwritten. Se recomienda que y link.xml se agregan al control de link.xml.meta versiones.It is recommended that link.xml and link.xml.meta be added to version control. Los desarrolladores deben tener la libertad de Assets/MixedRealityToolkit.Generated/link.xml personalizar para satisfacer las necesidades del proyecto.Developers should feel free to customize Assets/MixedRealityToolkit.Generated/link.xml to meet the needs of the project.

De forma predeterminada, link.xml archivo creado por MRTK conserva la totalidad de los ensamblados que se muestran en los datos siguientes.By default, the link.xml file created by MRTK preserves the entirety of the assemblies shown in the following data.

<linker> 
  <!-- 
    This link.xml file is provided to prevent MRTK code from being optimized away 
    during IL2CPP builds.More details on when this is needed and why this is needed 
    can be found here: https://github.com/microsoft/MixedRealityToolkit-Unity/issues/5273 
    If your application doesn't use some specific services (for example, if teleportation system is 
    disabled in the profile), it is possible to remove their corresponding lines down 
    below(in the previous example, we would remove the TeleportSystem below). 
    It's recommended to start with this list and narrow down if you want to ensure 
    specific bits of code get optimized away. 
  --> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.SDK" preserve="all"/> 
  <!-- Core systems --> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Services.BoundarySystem" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Services.CameraSystem" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Services.DiagnosticsSystem" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Services.InputSystem" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Services.SceneSystem" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Services.SpatialAwarenessSystem" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Services.TeleportSystem" preserve="all"/> 
  <!-- Data providers --> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Providers.LeapMotion" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Providers.OpenVR" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Providers.UnityAR" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Providers.WindowsMixedReality.Shared" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Providers.WindowsMixedReality" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Providers.XRSDK.WindowsMixedReality" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Providers.WindowsVoiceInput" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Providers.XRSDK" preserve="all"/> 
  <!-- Extension services --> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Extensions.HandPhysics" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Extensions.Tracking" preserve="all"/> 
  <assembly fullname = "Microsoft.MixedReality.Toolkit.Extensions.SceneTransitionService" preserve="all"/> 
</linker>

Para obtener más información sobre el link.xml de archivos, consulte la documentación de Unity.For more information on the link.xml file format, please refer to the Unity documentation.

Consulte tambiénSee also