edited February 2014 in ORK Scripting
I have some custom class, which has few varibales like

int[][]
string

....


is it possible for me to derive this class from some other class of ORK, so that ORK automatic save game system would load/save my class variables as well? I can try and derive from ORK basic data class, but I want to know if there are any potential minefields.
Post edited by gamingislove on
  • You can do this by implementing the ISaveData interface.

    Multi-dimensional arrays (e.g. int[][]) are a problem and would need to be handled some other way (e.g. having a wrapper class around an int[] and making a wrapper array). The simple data types (bool, string, float, int and their one-dimensional arrays) are no problem.

    The interface contains 2 functions to save and load data, both use the DataObject class. An example implementation can be seen in the GameHandler class - that's also where I'd recommend hooking in for saving your custom data.

    The DataObject class handles storing the data and is part of the closed source, but most functions are already documented and should display their infos in MonoDevelop. It's pretty easy, to store data:

    dataObject.Set(string key, T value);
    dataObject.Set(string key, T[] value);


    And to load data:

    dataObject.Get(string key, ref T value);
    dataObject.Get(string key, out T[] value);
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks, that is plenty enough of info to get it all working right!
Sign In or Register to comment.