Search Issue Tracker
Fixed in 2021.2.X
Fixed in 2020.3.X, 2021.1.X
Votes
2
Found in
2020.2.0a20
2020.3
2021.1
2021.1.1f1
2021.2
Issue ID
1327800
Regression
Yes
[IL2CPP] Vector-Graphics BuildSprite fails when using IL2CPP backend
Reproduction steps:
1. Open user attached Project
2. Build the SampleScene with IL2CPP
3. Open the Build
Expected result: A Vector sprite is drawn on the screen
Actual result: An empty scene is loaded
Reproducible with: 2020.2.0a20, 2020.3.5f1, 2021.1.4f1, 2021.2.0a14
Not reproducible with: 2019.4.24f1, 2020.2.0a19
-
lukasv88
Apr 29, 2021 10:59
This issue is caused by reflection inside the BuildSprite method:
// The Sprite.Create(Rect, Vector2, float, Texture2D) method is internal. Using reflection
// until it becomes public.
var spriteCreateMethod = typeof(Sprite).GetMethod("Create", BindingFlags.Static | BindingFlags.NonPublic, Type.DefaultBinder, new Type[] { typeof(Rect), typeof(Vector2), typeof(float), typeof(Texture2D) }, null);
var sprite = spriteCreateMethod.Invoke(null, new object[] { rect, pivot, svgPixelsPerUnit, texture }) as Sprite;Sprite is located in UnityEngine.CoreModule and we were able to work around the issue for now by adding <assembly fullname="UnityEngine.CoreModule" preserve="all"/> into link.xml.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note (fix version 2021.2):
Fixed in 2022.1.0a1
Resolution Note (fix version 2021.2):
Fixed in 2021.2.0b7
Resolution Note (fix version 2021.1):
Fixed in 2021.1.14f1
Resolution Note (fix version 2020.3):
Fixed in 2020.3.14f1
Fix managed code stripping issue due to reflection in com.unity.vectorgraphics.