Saving an string array

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
Miguelfanclub
Posts: 10
Joined: Fri May 04, 2018 2:25 pm

Saving an string array

Post 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"
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving an string array

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Locked