GameDataObjects - KitchenMods/KitchenLib GitHub Wiki
GameDataObjects are scriptable objects used in PlateUp! to create a large number of everything you see on the screen, from Appliances, Items, and even the floor you walk on.
As with everything there will be some exceptions to this rule such as Doors, and UI (There is likely more that we still haven't discovered)
As we've previously established, GameDataObjects are scriptable objects, these objects are made in the Unity Editor, but we unfortunately don't have access to this, KitchenLib have built a work-around which we will explain later.
GameDataObjects all have individual IDs, and all derive from the GameDataObject
class. These are all in a List<GameDataObject>
and stored inside GameData
.
This is done inside GameDataConstructor.BuildGameData()
.
KitchenLib has provided developers a way to create their own GameDataObjects without the need of the Unity Editor.
When creating a Custom GameDataObject you will need to create a class deriving from the Custom class.
ie. MyNewAppliance : CustomAppliance
, each Custom GameDataObject class provides a number of fields which can be overrided allowing developers to make edits to their GameDataObject.
Once you've created this GameDataObject you'll need to register it, we suggest registering it inside of OnPostActivate(Mod mod)
which can be overriden inside your Main class.
Each custom class has the same name as the GameDataObject it's creating, with the prefix Custom
. ie. Appliance
will be CustomAppliance
public class MyAppliance : CustomAppliance
{
public override int BaseGameDataObject => ApplianceReferences.Hob; // This is defining an existing GameDataObject to base ours off (In this case, the Hob)
public override string Name => "My Appliance"; // This is setting the Name for our Appliance
public override string Description => "Super Cool Appliance!"; // This is setting the Description for our Appliance
}
public class Main : BaseMod
{
protected override void OnPostActivate(Mod mod) // This method is called as soon as your mod is loaded.
{
AddGameDataObject<MyAppliance>(); // This method is what registers our GameDataObject.
}
}
Below are some linked pages related to each type of GameDataObject, the values which can be overriden, and various details about them.