Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

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?

(1 edit)

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 :)

(+2)

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 ^_^

Cheers man! will do :)

Linux version is up now! Hope it works, and that I didn't break something else :D