So, first of all, I am rather experienced (not saying pro, but I’m quite good) C# programmer. I am learning Unity to get a hold on game development, so I can later program own game without any engine (this will allow me use ways of programming I got used to but Unity API won’t allow me). It goes slowly (cause of my lazyness) but quite good imo, and then there I experienced this problem today:
Basically I am upgrading displaying recent changes on main menu. I made it check for changelog file and parse data from it, and if it doesn’t exist - download data from text file on a server. When running in editor, it works exactly how I made it work, but when I upload to ftp and open the build, it acts like it’s skipping a whole method:
void Start()
{
_cache = Camera.main.transform.rotation;
GetChangelog();
}
private void GetChangelog()
{
if (System.IO.File.Exists("changelog.txt"))
{
blahh.text = "found file";
System.IO.StreamReader rd =
new System.IO.StreamReader("changelog.txt");
string line = rd.ReadLine();
while (line != null line.Trim().Length > 0)
{
linesCount++;
text += System.Environment.NewLine + line;
line = rd.ReadLine();
}
rd.Close();
}
else
{
blahh.text = "didn't find file";
//downloading data from the server goes here
...
(Note: I know it might not be the best way to do it, but it’s how I got used to it while programming anything else in past few years, and it works well)
blahh is reference to GUIText I added temporarily to check where the code stops executing. And the problem is, text on screen stays the same (therefore it skips the if and else statements).
Maybe am tired and doing some damn stupid mistake, but well, I tried many things, even calling the method once in the begining of update (cause everything else in update works) and this still won’t work. Any ideas?