Hi GiL,

I’ve extended the editor to add a data list to store events, and now I need to save the execution count of each event in the game’s save file. However, I’m running into some issues.

First, it seems that ORK’s custom save data doesn’t support storing Dictionary types, and I had trouble understanding the "Class within a Class" section in the documentation.

Also, I’d like to use the GUID from my extended data list as the key, but I’m not sure how to iterate over the list to get all the GUIDs, and I’m not sure where to look in the ORK source code for guidance on this. Could you provide some advice on how to proceed?

Thanks in advance for your help!
  • That's hard to say without knowing your data and structure.

    Generally, the DataObject class used for saving/loading stores the individual data as dictionaries with string value keys, and you can directly set a whole one via the SetData function (and get one via GetData. If you have a dictionary with supported data types you can directly set and get it like that, .g. if you have a Dictionary< string, float>.

    Otherwise, you will need to split it into 2 separate entries, e.g. one for storing keys and one for storing content.
    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!
  • Hi GiL,

    Thanks for the response! I think I understand the part about saving data now.

    For the GUID issue, I realized that what I really need to know is how to retrieve GUIDs at runtime, similar to how it works for ORK built-in data like Items or Combatants. I've extended ORK with a GameEventSetting class (based on the BaseIndexDataWithType structure), but I'm not sure how to access the GUIDs for my custom data list.


    public class GameEventSetting : BaseIndexDataWithType<GameEventTypeAsset, GameEventType>
    {
    public GameEventSetting()
    {
    }

    [EditorHelp("Name", "The name of the game event.")]
    [EditorFoldout("Event Settings", "Set the name and base settings for event.")]
    [EditorWidth(true)]
    public string name = "";

    [EditorHelp("Event Prefab", "The event prefab.")]
    [EditorSeparator]
    public AssetSource<GameObject> prefab = new();

    [EditorHelp("Event Type", "The type will be used as priority.")]
    public AssetSelection<GameEventTypeAsset> type = new();

    public GameEventSetting(string name) : base(name)
    {
    this.name = name;
    }

    public override void SetData(DataObject data)
    {
    base.SetData(data);
    }

    public override string EditorName
    {
    get { return this.name; }
    set { this.name = value; }
    }

    public override GameEventTypeAsset TypeAsset
    {
    get { return this.type.StoredAsset; }
    }
    }


    Could you point me in the right direction for retrieving those GUIDs(or names) at runtime?
  • The class itself already has the GUID, which is part of the BaseIndexData class.

    However, since this is custom data, to have it in the editor you'd also need to have a overall settings class and editor class to manage this.

    E.g. if you look at the CombatantSetting class, this also has a CombatantsSettings class to reference the assets and a CombatantsTab class.
    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!
  • I can't believe I missed that... You're absolutely right, and I've now successfully retrieved the GUID. Thanks so much for your help and guidance!
Sign In or Register to comment.