Forum rules - please read before posting.

Save a list

So I've been playing with this asset for quite a while now and I can only say, it's one of the best things after hot water, however I'm a bit stuck. 
I have a scene which depends a lot on three custom lists that I made. 

Here is the class that I made for my list elements :
[System.Serializable]  
public class Person {
    public string name;
    public int id;
    public int conversation_id;

    public Person(string _name, int _id, int _cid){
        name = _name;
        id = _id;
        conversation_id = _cid;
    }
}  

Then I populate my list and in the end I have something like this:
image

Now there is a function which will remove one element at a time. For example Brandy did what she had to do, now we delete her field and we have only 8 more. 

My problem is that I don't know how to save this list, so if the player reaches a point when there are only 4 elements left, then he saves and when he comes back to have only those 4 elements.

Is there a way to create custom variables or something similar?

Thank you,
Hapciupalit

Comments

  • Both local and global custom data can be saved - see the tutorials here:
    You may find that instead of removing elements of the list, and trying to save the entire contents in one go, it's easier to instead introduce an "isActive" bool to your Person class which you set to True when not needed, and simply save the state of each such bool.
  • Oh, thank you very much. Yes, you are right, that would be much, easier.
    I completely forgot about the documentation, my bad. But thanks for your help.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.