I know this has been asked thousand times, but I just can not see the error. I have a xml file placed in a streaming assets folder. I am able to read it for any platform except the WebGL. I test it in Firefox. There is not even a way to debug it but I know the problem is here because of the Firefox console. It says, the problem is in LanguageManager when calling the getString() - no strings just exists. See the code bellow:
    public class LanguageManager : MonoBehaviour
    {
    	private Hashtable Strings;
    	private string filePath;
    	void Awake()
    	{
    		if (Application.platform == RuntimePlatform.WindowsEditor)		// If Unity Editor...
    		{
    			filePath = "Assets/StreamingAssets/Languages.xml";
    		}
    		else if (Application.platform == RuntimePlatform.WindowsPlayer)	// If Standalone...
    		{
    			filePath = Application.dataPath + "/StreamingAssets/Languages.xml";
    		}
    		else if (Application.platform == RuntimePlatform.Android)		// If Android...
    		{
    			string tempPath = System.IO.Path.Combine (Application.streamingAssetsPath, "Languages.xml");
    			// Android only use WWW to read file
    			WWW reader = new WWW (tempPath);
    			while (!reader.isDone) {
    			}
    			filePath = Application.persistentDataPath + "/db";
    			System.IO.File.WriteAllBytes (filePath, reader.bytes);
    		}
    		else if (Application.platform == RuntimePlatform.WebGLPlayer)	// If WebGL ERROR HERE
    		{
    			filePath = System.IO.Path.Combine (Application.streamingAssetsPath, "Languages.xml");
    		}
    		string language = PlayerPrefs.GetString ("LanguageSettings", "English");	// Set Language.
    		var xml = new XmlDocument();
    		xml.Load(filePath);	// Define path to the XML document.
    		Strings = new Hashtable();
    		var element = xml.DocumentElement[language];
    		if (element != null)
    		{
    			var elemEnum = element.GetEnumerator();
    			while (elemEnum.MoveNext())
    			{
    				var xmlItem = (XmlElement)elemEnum.Current;
    				Strings.Add(xmlItem.GetAttribute("name"), xmlItem.InnerText);
    			}
    		}
    		else
    			Debug.LogError("The specified language does not exist: " + language);
    	}
    	public string getString (string name)
    	{
    		if (!Strings.ContainsKey(name))
    		{
    			Debug.LogError("The specified string does not exist: " + name);
    			return "";
    		}
    		return (string)Strings[name];
    	}
    }
                       
                           
                       
                     ↧