Skip to content

Commit c0ed0e2

Browse files
Added StrippingLevelCheck Build Preprocessor (#1004)
Co-authored-by: = <=> Co-authored-by: Nikola Garabandic <kantagara@gmail.com>
1 parent f2fce3d commit c0ed0e2

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using UnityEditor;
2+
using UnityEditor.Build;
3+
using UnityEditor.Build.Reporting;
4+
5+
public class StrippingLevelCheckBuildPreprocessor : IPreprocessBuildWithReport
6+
{
7+
private const string dialogMessage = "Some of the components of the ChainSafe Gaming SDK might not behave properly when stripping level is stricter than Minimal.\n\nDo you want to switch the stripping level setting to Minimal?";
8+
private const string dialogTitle = "Set Stripping Level to Minimal";
9+
10+
public int callbackOrder { get; }
11+
12+
public void OnPreprocessBuild(BuildReport report)
13+
{
14+
var buildGroup = report.summary.platformGroup;
15+
16+
var strippingLevel = PlayerSettings.GetManagedStrippingLevel(buildGroup);
17+
18+
if (strippingLevel == ManagedStrippingLevel.Disabled) return;
19+
if (strippingLevel == ManagedStrippingLevel.Minimal) return;
20+
21+
var switchToMinimal = EditorUtility.DisplayDialog(
22+
dialogTitle,
23+
dialogMessage,
24+
"Switch to Minimal",
25+
"Ignore");
26+
27+
if (!switchToMinimal) return;
28+
29+
PlayerSettings.SetManagedStrippingLevel(buildGroup, ManagedStrippingLevel.Minimal);
30+
}
31+
}

Packages/io.chainsafe.web3-unity/Editor/StrippingLevelCheckBuildPreprocessor.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)