Skip to main content

EntityManagerObject

class SoftKitty.EntityManagerObject : DataObject

EntityManagerObject is a DataObject that manages and handles all Entity in the system, providing easy access and modification.

You can create this object via the context menu in any Project folder:

Create → SoftKitty → Data Objects → Entity Manager Data

You can assign the created asset to the database in:

Project Settings → SoftKitty → Data Settings → Data

After assigned the data object, a editor interface can be found at:

Project Settings → SoftKitty → Entity Manager

Where you can easily manage Entities with all kinds of convenient tools.


Properties​

public static EntityManagerObject instance​

Retrieve the instance of the EntityManagerObject instance assigned in SoftKitty Data Settings.


Methods​

public EntityCollection EntityData​

The collection of entity data, holding all the registered entities.


public string[] CustomDataUidArray​

Returns a list of custom data UIDs for the entities.


public List<string> EntityUidList​

A list of all entity UIDs.


public string ToJson(string _extraInfo)​

Converts all entities (along with any extra info) into a JSON string for saving. This is useful for saving and loading entity data.


public string SingleEntityToJson(string _uid)​

Returns the JSON string for a specific entity by its UID.


public string FromJson(string _json)​

Loads entity data from a JSON string. The method also returns the extra info from the saved file.


public void Save(string _path, string _extraInfo)​

Saves all entities’ data to a file at the provided path, along with any extra info in JSON format.


public void SaveSingleEntity(string _uid, string _path)​

Saves data for a single entity (identified by UID) to the provided path.


public string Load(string _path)​

Loads entity data from a file at the provided path and returns the extra info from the save.


public void LoadSingleEntity(string _uid, string _path)​

Loads data for a single entity (by UID) from the provided path.


public Entity NewEntity()​

Creates a new entity and returns it.


public Entity NewEntity(string _uid)​

Creates a new entity with the specified UID and returns it.


public int GetCustomIndex(string _uid)​

Retrieves the index number of custom data by providing its UID.


public CustomData.CustomTypes GetCustomType(string _uid)​

Gets the custom data type by providing the UID.


public string GetCustomUid(CustomData.CustomTypes _type, int _index)​

Retrieves the UID of custom data based on its type and index.


public Entity GetEntity(string _uid)​

Retrieves an entity by its string UID. This method caches results for better performance.


public Entity GetEntity(int _id)​

Retrieves an entity by its integer ID. Results are cached for better performance.


public string GetStringKey(int _id)​

Retrieves the string UID of an entity by its integer ID.


public int GetId(string _key)​

Retrieves the integer ID of an entity by its string UID.