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
Comments (1)
-
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
- SpeedTree meshes and objects count differs when comparing the numbers in the Player with the Editor
- Model and Prefab Preview icons are not updated after upgrading associated Materials to URP
- Game view is rendered white when viewing the Editor with HDR display and Post Proccesing is enabled on the Main Camera with 2D URP
- "GetPreferedValue" returns max value when using auto-sizing
- UI Builder doesn't update the style sheet when using "Extract inline style" right-click option
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.