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
- Awaitable.NextFrameAsync() fails to resume when invoked multiple times from the playModeStateChanged event
- Text input duplicates in the TextField when textField.isDelayed is set to true and typing with a Japanese keyboard layout
- “AssetDatabase.GetMainAssetTypeAtPath" returns the incorrect type when using a global namespace class with the same name as a Unity type
- Editor silently crashes when switching platforms when Meta XR Core SDK is imported
- Crash on Object::SetCachedScriptingObject when entering the Play Mode immediately after stopping asynchronous operations in the previous Play Mode session
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.