- Home /
writeStringToMemory is deprecated When Loading Assetbundle on photon
I am loading a Scene from assetbundle in WebGl and unable to join or create random room and stuck on this error:
writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!
I am using a node.js API to load assetbundel based on user data and to parse JSON I use SimpleJSON
In Editor its working fine.
I am using PUN2 and Unity 2019.20.f1
This is the complete Log Screenshot .

The code to build assetbundle
[MenuItem("Assets/Build AssetBundles")]
static void BuildAllAssetBundles()
{
string assetBundleDirectory = "Assets/StreamingAssets";
if (!Directory.Exists(Application.streamingAssetsPath))
{
Directory.CreateDirectory(assetBundleDirectory);
}
BuildPipeline.BuildAssetBundles(assetBundleDirectory, BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
}
And the coroutine to load assetbundel
IEnumerator Loadmodel(string bundleUrl)
{
using (WWW web = new WWW(bundleUrl))
{
yield return web;
AssetBundle remoteAssetBundle = web.assetBundle;
if (remoteAssetBundle == null)
{
Debug.LogError("Failed to download AssetBundle!");
yield break;
}
string[] scenePaths = remoteAssetBundle.GetAllScenePaths(); //loading all scene path
Debug.Log(scenePaths);
string sceneName = System.IO.Path.GetFileNameWithoutExtension(scenePaths[0]);
PhotonNetwork.LoadLevel(sceneName);
}
yield return null;
}
Answer by unity_tkE9z0iZuUJQ9g · Sep 20, 2021 at 10:00 AM
The solution that work for me is Try Low MTU (MaximumTransferUnit) . The problem is Webgl is send more data to photon server in specific time than Editor. when I add this line in my code all errors are gone .
loadBalancingClient.LoadBalancingPeer.MaximumTransferUnit = 500;
For more detail https://doc.photonengine.com/zh-cn/realtime/current/troubleshooting/analyzing-disconnects
Hope this will help other.
Your answer
Follow this Question
Related Questions
PhotonNetwork.GetRoomList() output = 0 1 Answer
How to update Unity project from Photon Unity Networking v1 to v2 (PUN to PUN 2) 1 Answer
How do I set up multiplayer? 0 Answers
Unable to set CustomProperties on JoinRandomRoom() method 0 Answers
Sending int value owned by Masterclient to other client 2 Answers