ES2.SaveRaw
Save Raw Bytes
Parameters
bytes | The raw bytes which we want to save as our file. |
path |
The path of the file we want to create to store our data. For more information, see Paths. |
settings |
Optional. A user-created ES2Settings object containing options not specified in path. |
Description
Saves a file containing our raw bytes.
Note: Path should point to a file.
C#
1 2 3 |
// Create a file containing only the bytes ABC123. byte[] bytes = new byte[]{'A','B','C','1','2','3'}; ES2.SaveRaw(bytes, "myFile.txt"); |
JS
1 2 3 |
// Create a file containing only the bytes ABC123. var bytes = ['A','B','C','1','2','3']; ES2.SaveRaw(bytes, "myFile.txt"); |
Save Raw String
Parameters
data | The raw string representing our file. It will be stored in the UTF8 encoding. |
path |
The path of the file we want to create to store our data. For more information, see Paths. |
settings |
Optional. A user-created ES2Settings object containing options not specified in path. |
Description
Saves a file containing our raw UTF8 string.
Note: Path should point to a file.
C#
1 2 |
// Create a file containing our own text. ES2.SaveRaw("String we want to save.", "myFile.txt"); |
JS
1 2 |
// Create a file containing our own text. ES2.SaveRaw("String we want to save.", "myFile.txt"); |
Save Raw Text Asset
Parameters
data | The TextAsset we want to save as a file. |
path |
The path of the file we want to create to store our data, which should have the extension .bytes. For more information, see Paths. |
settings |
Optional. A user-created ES2Settings object containing options not specified in path. |
Description
Saves a TextAsset as a file which will contain the same bytes as the TextAsset.
Note: The TextAsset must have the extension ‘.bytes’.
Note: Path should point to a file.
C#
1 2 3 |
// Create a file containing only the bytes ABC123. TextAsset file = Resources.Load("myFile") as TextAsset; ES2.SaveRaw(file, "myFile.txt"); |
JS
1 2 3 |
// Create a file containing only the bytes ABC123. var file = Resources.Load("myFile") as TextAsset; ES2.SaveRaw(file, "myFile.txt"); |