Encoding 437 data could not be found - Error in Unity3d Build

I was developing a unity3d application that was interacting with excel file using a u3d opensource pacakage. It was working fine in the unity editor. My excel data was showing in editor but after building for windows platform it was not showing excel data in unity anymore. I checked the debug logs of my standalone player and found below error

Uploading Crash Report NotSupportedException: Encoding 437 data could not be found. Make sure you have correct international codeset assembly installed and enabled. at System.Text.Encoding.GetEncoding (System.Int32 codepage) [0x0023f] in :0 at ICSharpCode.SharpZipLib.Zip.ZipConstants.ConvertToString (System.Byte[] data, System.Int32 count) [0x0000e] in <8e8fa28d216a43ec8dcb2258d1f7bf00>:0 at ICSharpCode.SharpZipLib.Zip.ZipConstants.ConvertToStringExt (System.Int32 flags, System.Byte[] data) [0x00022] in <8e8fa28d216a43ec8dcb2258d1f7bf00>:0 at ICSharpCode.SharpZipLib.Zip.ZipInputStream.GetNextEntry () [0x0014a] in <8e8fa28d216a43ec8dcb2258d1f7bf00>:0 at (wrapper remoting-invoke-with-check) ICSharpCode.SharpZipLib.Zip.ZipInputStream.GetNextEntry() at NPOI.OpenXml4Net.Util.ZipInputStreamZipEntrySource..ctor (ICSharpCode.SharpZipLib.Zip.ZipInputStream inp) [0x00015] in <09654f5254b44255887f6f774978077f>:0 at NPOI.OpenXml4Net.OPC.ZipPackage..ctor (System.IO.Stream filestream, NPOI.OpenXml4Net.OPC.PackageAccess access) [0x00015] in <09654f5254b44255887f6f774978077f>:0 at NPOI.OpenXml4Net.OPC.OPCPackage.Open (System.IO.Stream in1) [0x00000] in <09654f5254b44255887f6f774978077f>:0 at NPOI.Util.PackageHelper.Open (System.IO.Stream is1) [0x00000] in <6fd7ca6bad364c5ea94149697e721400>:0 at NPOI.XSSF.UserModel.XSSFWorkbook..ctor (System.IO.Stream is1) [0x00026] in <6fd7ca6bad364c5ea94149697e721400>:0 at DataConverters.ExcelToCsvWithNpoi.Convert (System.IO.MemoryStream stream) [0x00015] in <092dda33cb1b4692b34f7feb073574ee>:0 at LoadExcelAndConvertToCsv.OnLoaded (System.IO.MemoryStream stream) [0x0000c] in <092dda33cb1b4692b34f7feb073574ee>:0 at DataLoaders.MemoryStreamLoader+d__0.MoveNext () [0x000e5] in <092dda33cb1b4692b34f7feb073574ee>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0 at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0 (System.Object state) [0x00000] in :0 at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00002] in <469e86e97fa2467ebffe49bbd6086325>:0 UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) UnityEngine.WorkRequest:Invoke() UnityEngine.UnitySynchronizationContext:Exec() UnityEngine.UnitySynchronizationContext:ExecuteTasks()

Encoding 437 data could not be found.

After making some research I found that Mono  does not include internalization by default that is required in the standalone application. So, in order to solve the error “Encoding 437 data could not be found. Make sure you have correct international codeset assembly installed and enabled” I have to copy two dlls into my projects plugins folder. The typical location of the dll files is

C:\Program Files\Unity\Hub\Editor\2019.4.27f1\Unity\Editor\Data\MonoBleedingEdge\lib\mono\unityaot

 I was using unity 2019.4.27. So at the unity installation location (given above), copy I18N.dll and I18N.West.dll into the plugins folder. Or you can directly copy it to standalone build under data -> Managed folder.

How Unity call it's MonoBehaviour Method or Events like Update

 Ever wonder how the magic events of unity Behavior works:

void Awake()

{

 

}

 

void Start()

{

 

}

 

void Update()

{

}

// Or other unity magic events like OnEnable, OnDisable, Late Update, Fixed Update, etc.,

The simple answer comes into mind that maybe unity use reflections to find Mono Behaviour methods in order to call it every time or maybe they use override to those methods but apparently, this is not happening. So how it calls its event especially the Update event that calls on every frame.

The way unity3d Messaging system works its:

1.      Unity scripting runtime Mono or IL2CPP access MonoBehaviour derived (type) script.

2.      Look for magic events and cache it.

3.      Like if a MonoBehaviour derived script has an update event then the script will be added into a list (list of scripts) that will be updated on every frame.

4.      Now during gameplay, unity iterates over the list and fire the Unity events. This is the reason that if you make your event public or private they don’t get effected.

 


Library\PackageCache\com.unity.package-manager-ui@1.9.11\Editor\AssemblyInfo.cs could not be found | Solution

You may get dozen of errors like

Library\PackageCache\com.unity.package-manager-ui@1.9.11\Editor\AssemblyInfo.cs could not be found. 

1.       You may get the UI package may error After importing ui package. Now for the solution of the UI Package Manager problem. Follow below steps or watch my below guide:

  1.     Go to Window -> Package Manager
  2.    Click on package Manager UI
  3.    Click to Update the Package

The error will disappear, see the below video:

Library\PackageCache\com.unity.package-manager-ui@1.9.11\Editor\AssemblyInfo.cs Solution

Preview Package is Missing in Unity 2020.3 - Solution

 Unity provides two kinds of packages verified and preview packages. Preview packages are on the development stage therefore, you cannot directly access preview packages (like Job system) in Package manager or its search. Preview package is missing is a config problem that we will resolve in this post: Follow the below steps in order to solve preview package missing problem in Unity3d:

1.       Go to window -> Package Manager

 

 On Package manager windows select the Dropdown (given on left) and select Unity Registry option. (This will provide you the list of available packages provide by unity). Remember it will not include preview packages. Like at the moment Unity Jobs system on the preview stage, if you try to search it then you will unable to find it.


.      

 Now in order to enable preview packages to show in the list. Go to Edit-> Project Settings -> then click on Package Manager.  Now here selects Enable Preview Package checkbox.

     Go back to the Package manager window. Now you can see Preview packages are also showing along with verified packages. Preview packages are clearly visible with preview text in orange color.

5.       Search for your desired package like jobs and you will find the result.

 

2.      

 

3


4.  

                                                                        


Get Request in Unity C# | Get data from a URL in unity

 You often require to access a URL/API endpoint in order to get/post data or communicate to a web server. For this reason, unity provides UnityWebRequest Class. The class specifically designed to handle HTTP communications. It provides set of functions especially Get and Post function to deal with data retrieval and data post operations: Here are the ways to use it:

Get Request: A common way to access data from a URL. Suppose you are trying to get JSON data from a URL/API (given below) and here is our working example URL

https://jsonplaceholder.typicode.com/todos/1

void Start()

    {

        string getURL = "https://jsonplaceholder.typicode.com/todos/1";

        StartCoroutine(GetReq(getURL));

    }

 

    IEnumerator GetReq(string url)

    {

        UnityWebRequest req = UnityWebRequest.Get(url);

        yield return req.SendWebRequest();//wait until request competed

 

        if (req.isNetworkError)//if the networkerror is true then, there is an error.

        {

            Debug.Log("Error While Sending: " + req.error);

        }

        else

        {

            Debug.Log("Received: " + req.downloadHandler.text);

        }

    }


If you have json string then you can deserailze it. Here is the detailed tutorail.