Kirbyrawr / dotnet-standard-bip39

NuGet library uploaded to use in Unity Package Manager
Apache License 2.0
0 stars 0 forks source link

Error when using this library for a WEBGL build in Unity #1

Open karakasis opened 3 years ago

karakasis commented 3 years ago

I'm getting the follow error in the Google Chrome console, when I'm running my WEBGL game that is using this dll. It works fine in the Unity Editor and when building for PC. Any ideas how to fix this? Thanks

MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "dotnetstandard-bip39.Resources.resources" was correctly embedded or linked into assembly "dotnetstandard-bip39" at compile time, or that all the satellite assemblies required are loadable and fully signed. at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing (System.String fileName) [0x00000] in <00000000000000000000000000000000>:0

(Filename: currently not available on il2cpp Line: -1)

karakasis commented 3 years ago

Looking at Elucidsoft code, this is coming from https://github.com/elucidsoft/dotnetstandard-bip39/blob/be9290f7e25bdccfdd6afd85db4e3e55f65fe935/dotnetstandard-bip39/BIP39.cs#L232

keyserjaya commented 2 years ago

I have the same issue, any solution? tried this: https://stackoverflow.com/a/1329631/11213686 then build new .dll Result: same, doesn't work

karakasis commented 2 years ago

Im not using the .dll now, made a new C# script with the code in the link from my previous comment, and modified Line 232 as below.

private static string[] GetWordlist(BIP39Wordlist wordlist)
        {
            var wordlists = new Dictionary<string, string>
            {
                {BIP39Wordlist.ChineseSimplified.ToString(), "chinese_simplified"},
                {BIP39Wordlist.ChineseTraditional.ToString(), "chinese_traditional"},
                {BIP39Wordlist.English.ToString(), "english"},
                {BIP39Wordlist.French.ToString(), "french"},
                {BIP39Wordlist.Italian.ToString(), "italian"},
                {BIP39Wordlist.Japanese.ToString(), "japanese"},
                {BIP39Wordlist.Korean.ToString(), "korean"},
                {BIP39Wordlist.Spanish.ToString(), "spanish"}
            };

            var wordListFile = wordlists[wordlist.ToString()];

            TextAsset worldListResultsAsset = UnityEngine.Resources.Load<TextAsset>("Wordlists/" + wordListFile);
            var fileContents = worldListResultsAsset.text;

            return fileContents.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            /*Modified the following code to make it work during runtime
            var wordListFile = wordlists[wordlist.ToString()];

            var wordListResults = UnityEngine.Resources.ResourceManager.GetString(wordListFile)
                .Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            return wordListResults;
            */
        }
Kirbyrawr commented 2 years ago

Apologies, didn't see the issue, glad it's fixed!