Page 1 of 1

Saving an string array

Posted: Fri Mar 01, 2019 10:49 pm
by Miguelfanclub
1. Finding game objects with a certain tag
2. Getting their names
3. Adding them to a string array
4. Saving string array

when looking in the ES2Editor, the tag is been created but i see "The file editor does not currently support this type"

Re: Saving an string array

Posted: Sun Mar 03, 2019 1:30 pm
by Joel
Hi there,

This can be done as follows in Easy Save 2:
var gos = GameObject.FindGameObjectsWithTag("tag");
var names = new string[go.Length]();
for(int I=0; i< gos.Length; i++)
    names = gos.name;
ES2.Save(names, "myFile.txt?tag=myTag");


And then to load:

names = ES2.LoadArray<string>("myFile.txt?tag=myTag");


With regards to it not showing in the File Editor, it appears to be working fine at my end? (see screenshot: https://imgur.com/rxOD5KN). Are you certain the type of data in the tag is a string[]?

All the best,
Joel