-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Metamask DLL should only be available on webGL (#1074)
Fixing metamask processing so that we don't ever get the iOS build error.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/UnitySampleProject/Assets/Scripts/Editor/DllPlatformFixing.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using UnityEditor; | ||
|
||
public class DllPlatformFixing : AssetPostprocessor | ||
{ | ||
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, | ||
string[] movedFromAssetPaths) | ||
{ | ||
for (var i = 0; i < importedAssets.Length; i++) | ||
if (importedAssets[i].Contains("ChainSafe.Gaming.Unity.MetaMask")) | ||
{ | ||
var importer = (PluginImporter)AssetImporter.GetAtPath(importedAssets[i]); | ||
if (importer == null) continue; | ||
//If it's already set to false, that means we've been here and can early return. | ||
if(!importer.GetCompatibleWithAnyPlatform()) | ||
return; | ||
|
||
importer.SetCompatibleWithAnyPlatform(false); | ||
importer.SetCompatibleWithPlatform(BuildTarget.WebGL, true); | ||
importer.SetCompatibleWithPlatform(BuildTarget.iOS, false); | ||
importer.SetCompatibleWithPlatform(BuildTarget.Android, false); | ||
importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false); | ||
importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false); | ||
importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false); | ||
importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false); | ||
importer.SetCompatibleWithEditor(false); | ||
|
||
|
||
EditorUtility.SetDirty(importer); | ||
importer.SaveAndReimport(); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/UnitySampleProject/Assets/Scripts/Editor/DllPlatformFixing.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.