When I run my game in Unity Web Player, It doesn’t work (app freeze, screen is black).
But PC build work fine without any errors.
In log I have:
MethodAccessException: Attempt to access a private/protected method failed.
at System.Security.SecurityManager.ThrowException (System.Exception ex) [0x00000] in <filename unknown>:0
at DataMgr.getDataResource (System.String filename) [0x00000] in <filename unknown>:0
at DataMgr.Init () [0x00000] in <filename unknown>:0
at main.Awake () [0x00000] in <filename unknown>:0
(Filename: Line: -1)
code of DataMgr.getDataResource() function
public static int getDataResource(string filename)
{
//open file
FileInfo aFile = new FileInfo(filename);
if (!aFile.Exists)
{
Log.Error("Error: File " + filename + " not found.");
return -1;
}
Log.Info("Read file: " + filename);
StreamReader reader = new StreamReader(filename, Encoding.UTF8);
int i = 0;
while (reader.Peek() != -1)
{
string line = reader.ReadLine(); // Line = sr.ReadToEnd();
if (i == 0) { i++; continue; }
string[] words = line.Split(';');
if (words.Length < 4) { Log.Error("Wrong file format"); break; }
words[0] = words[0].Trim();
words[1] = words[1].Trim();
words[2] = words[2].Trim();
words[3] = words[3].Trim();
words[4] = words[4].Trim();
Resource resource = new Resource();
resource.image = "Textures/ico/res/" + words[0];
resource.id = words[1];
resource.name_im = words[2];
resource.name_ro = words[3];
resource.info = words[4];
m_gameResources.Add(resource);
Log.Info("Read res: " + resource.info);
i++;
}
Log.Info("End read");
return 0;
}
What I am doing wrong?