Thank you for uploading it. It seems like there is a problem with level 6. The game doesn't seem to be able to locate or read the file correctly. You mentioned in another post looking into creating the file with moving=false written in it. That may be able to fix the issue, by showing where the game accesses the file system. Otherwise i haven't found anything not working, except maybe the in game cursor being too big, but that might be a problem with my compositor and doesn't impact the functionality.
Oh thanks a bunch for going out of your way to help man!
So, could you make a script - put it on an object in the scene, and put this line in:
void Start(){ Debug.Log(Application.dataPath); }
Then build and run a Linux version and tell me what the Player log says. I don't know how much you remember about Unity but you can find the Standalone Player log in the console tab
[Edit] Ah, I see you make games so I'm probably over-explaining this 😄
Thanks Timeearl!!
Ok, so after some testing it seems like the <Project_Name>_Data folder is targeted by Application.dataPath, but when i tried moving a file named platformsettings.txt containing just the line "moving=true" into it, it didn't work.
I tried approximating what you did (read file, discard white spaces, ignore capitalization and compare) and the code
StreamReader reader = new StreamReader(Application.dataPath + "/platformsettings.txt"); bool platformMoving = string.Concat(reader.ReadToEnd().Where(c =>!char.IsWhiteSpace(c))).ToLower().Contains("moving=true"); Debug.Log(platformMoving);
returned True for the file "platformsettings.txt" containing
randomMOVING = True letters
Does your implementation differ from mine substantially?
hmm, mine differs a little, but not massively. I still don't see why it wouldn't work. You're doing things in a slightly more smart way, replacing all the blank spaces. This is my exact implementation
using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO; public class Level10 : MonoBehaviour { public MovingPlatform movingPlatform; string normalPath; string normalPath2; public MovingPlatform bug; string bugPath; string bugPath2; void Start() { normalPath = Path.GetFullPath(Application.dataPath + @"\platformsettings.txt"); normalPath2 = normalPath.Replace(@"\ThatGame_Data",""); bugPath = Path.GetFullPath(Application.dataPath + @"\bugsettings.txt"); bugPath2 = bugPath.Replace(@"\ThatGame_Data",""); } void Update() { if (!movingPlatform.forceMove) { if (File.Exists(normalPath)) { if (ReadString(normalPath)) { movingPlatform.forceMove = true; } } if (File.Exists(normalPath2)) { if (ReadString(normalPath2)) { movingPlatform.forceMove = true; } } } if (PlayerPrefs.GetInt(gameObject.transform.parent.name) != 1) { if (File.Exists(bugPath)) { if (ReadString(bugPath)) { bug.forceMove = true; } } if (File.Exists(bugPath2)) { if (ReadString(bugPath2)) { bug.forceMove = true; } } } } public bool ReadString(string path) { StreamReader reader = new StreamReader(path); if ( Read(path, reader, "moving = true") || Read(path, reader, "moving= true") || Read(path, reader, "moving =true") || Read(path, reader, "moving=true")) { reader.Close(); return true; } else { reader.Close(); return false; } } public bool Read(string path, StreamReader reader, string check) { reader = new StreamReader(path); if (reader.ReadToEnd().Contains(check)) { reader.Close(); return true; } else { reader.Close(); return false; } } }
I'm a little confused, not really sure what to suggest... I'll have a think but seems my brain isn't working this evening 😅Sorry about the blocked progress in the game!
Also thanks again for doing that :)
Found the Problem. I didn't think about it before, but the file separator for Windows is "\" and for Linux it is "/". I had that problem in another project before so i'm a bit mad at myself for not noticing. The Proper way of doing it is
Path.GetFullPath(Application.dataPath + Path.DirectorySeparatorChar + filename);
Path.DirectorySeparatorChar replaces the "/" or "\".
I tested it and it works for Linux. Since it changes the char according to the Operating System it should work for Windows and Mac as well.
I created a file named ThatGame_Data\platformsettings.txt in the Folder which contains the ThatGame_Data Folder and was able to finish the Level that way xD
Oh, siiick. Thanks so much for finding that. What a weird problem! You've definitely saved me a LOT of time and frustratiomn looking for the problem, I can't thank you enough :)
Ok I'll implement that fix v. v. soon. I messed some stuff up in the project (improving the editor dragging) But once I've fixed this I'll upload a new version for you.
Cheers man!!
No Problem, without me the Problem wouldn't exist at all so that was the minimum i could do.
Thank you for taking the time to fix it.
Not too many devs care about non-mainstream operating systems so this was a quite pleasant change of pace :]
If you ever need some help with testing for Linux let me know ^_^