Is there a portable way to present text for editing?

Like many games, mine have a text config file. It would be handy to allow (some) users to edit the config file directly. I don’t really care whether it’s a window with editable text in it (like the Editor) or a download/upload for the user to use their own text editor, as long as it’s portable across desktop, Mac, WebGL, etc.

Is it possible? How?

If you place the config file in the StreamingAssets folder, it will be copied as-is to the game directory, and users can edit it there. You’d then read from it at startup.

A similar approach would be to store the file in the PersistentDataPath, and have the game generate the default file there the first time it’s loaded.

Both of those solutions are portable over operating systems, though you’ll have to send different instructions to your users about where to find the file. It’s also possible to later write a window that allows the users to edit the file in-game.

ive never tryed this on a mac but this works with windows.
this would write a file only if its missing. and then read whatever is there.

using System;
    using System.IO;
    using System.Diagnostics;

 void Start() {
    		string contents;
    		string path = "C:/somefile.txt";
    			File.WriteAllText(path,"blah blah blah");}
    		contents=File.ReadAllText (path);
    		print ("config:"+contents);