ES2Reader.ReadArray
Read Array with Tag
Parameters
T | The type of the data in the array we want to load. Must be on the Supported Types list. |
tag |
The tag which we want to load. |
Returns
T[] | Our loaded data |
Description
Reads the array of type T from the ES2Reader with the given tag.
C#
Reading tags from an ES2Reader
1 2 3 4 5 6 7 |
using(ES2Reader reader = ES2Reader.Create("myFile.txt")) { // Read data from the file in any order. reader.Read<Transform>("transformTag", this.transform); // Self-assigning Read this.name = reader.Read<string>("nameTag"); int[] myIntArray = reader.ReadArray<int>("intArrayTag"); } |
JS
Reading tags from an ES2Reader
1 2 3 4 5 6 7 |
var reader : ES2Reader = ES2Reader.Create("myFile.txt")) // Read data from the file in any order. reader.Read.<Transform>("transformTag", this.transform); // Self-assigning Read. this.name = reader.Read.<String>("nameTag"); var myIntArray = reader.ReadArray.<int>("intTag"); // Remember to dispose when we're finished. reader.Dispose(); |
Self-Assigning Read Array with Tag
Parameters
tag | The tag which we want to load. |
components |
The Components we want to assign our loaded data to. Must be in the Supported Types list. |
Description
Self-Assigning Read. Reads the Components of type T from the specified ES2Reader and automatically assigns it to the Components in our components array.
C#
Reading tags from an ES2Reader
1 2 3 4 5 6 7 |
using(ES2Reader reader = ES2Reader.Create("myFile.txt")) { // Read data from the file in any order. reader.Read<Transform>("transformTag", this.transform); // Self-assigning Read this.name = reader.Read<string>("nameTag"); int[] myIntArray = reader.ReadArray<int>("intArrayTag"); } |
JS
Reading tags from an ES2Reader
1 2 3 4 5 6 7 |
var reader : ES2Reader = ES2Reader.Create("myFile.txt")) // Read data from the file in any order. reader.Read.<Transform>("transformTag", this.transform); // Self-assigning Read. this.name = reader.Read.<String>("nameTag"); var myIntArray = reader.ReadArray.<int>("intTag"); // Remember to dispose when we're finished. reader.Dispose(); |
Sequential Read Array
Parameters
T | The type of the data in the array we want to load. Must be on the Supported Types list. |
Returns
T[] | Our loaded data |
Description
Reads the array of type T from the ES2Reader. The data must have been saved sequentially using ES2Writer.
C#
Reading data sequentially from an ES2Reader
1 2 3 4 5 6 7 |
using(ES2Reader reader = ES2Reader.Create("myFile.txt")) { // Read the data from the file in the same order as we saved it. this.name = reader.Read<string>(); reader.Read<Transform>(this.transform); int[] myIntArray = reader.ReadArray<int>(); } |
JS
Reading data sequentially from an ES2Reader
1 2 3 4 5 6 7 |
var reader : ES2Reader = ES2Reader.Create("myFile.txt")) // Read the data from the file in the same order as we saved it. this.name = reader.Read.<String>(); reader.Read.<Transform>(this.transform); var myIntArray = reader.ReadArray.<int>(); // Remember to dispose when we're finished. reader.Dispose(); |
Self-Assigning Sequential Read Array
Parameters
tag | The tag which we want to load. |
component |
The Components we want to assign our loaded data to. Must be in the Supported Types list. |
Description
Self-Assigning Read. Reads the Components of type T from the specified ES2Reader and automatically assigns it to the Components in our components array.
C#
Reading data sequentially from an ES2Reader
1 2 3 4 5 6 7 |
using(ES2Reader reader = ES2Reader.Create("myFile.txt")) { // Read the data from the file in the same order as we saved it. this.name = reader.Read<string>(); reader.Read<Transform>(this.transform); // Self-assigning Read. int[] myIntArray = reader.ReadArray<int>(); } |
JS
Reading data sequentially from an ES2Reader
1 2 3 4 5 6 7 |
var reader : ES2Reader = ES2Reader.Create("myFile.txt")) // Read the data from the file in the same order as we saved it. this.name = reader.Read.<String>(); reader.Read.<Transform>(this.transform); // Self-assigning Read. var myIntArray = reader.ReadArray.<int>(); // Remember to dispose when we're finished. reader.Dispose(); |