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
- Buttons in the Overlay Menu in the Scene View are all gray even if they're activated when Game View is maximized and minimized
- NullReferenceException is thrown when baking Adaptive Probe Volume for a Terrain with Non-GI Contributing Tree Prototypes and multiple APV objects with different LayerMasks are present on the scene
- Hands are not recognized when using Hololens 2
- "OnTriggerExit2D" is called before "OnTriggerEnter2D" when object is destroyed immediately
- Editor crashes on PrepareSpriteTilingData when exiting Play mode
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.