Generated tab scripts live in:
Assets/GHUDatabase/GHUDScripts/Tabs/
GHUD rebuilds these files when the database is refreshed. Do not edit them for project-specific behavior.
Code added to the spreadsheet tab scripts will be overwritten each time you update the GHUD data.
Because of this, GHUD generates each [TabName].cs as a partial C# class.
Use custom partial scripts to add code to the tab classes for helpers, queries, validation, runtime convenience methods, or custom Unity-side fields without changing the core generated files.
Create a user-owned C# script under:Â
Assets/GHUDatabase/UserScripts/Partials/
Use a unique filename such as:Â
Items_Custom.cs,
Items_Helpers.cs, or
Items_Queries.cs.
(Don't use [TabName]_Assets.cs or [TabName]_Rows.cs)
Declare the same partial class as the generated tab:
public partial class [TabName]
{
Â
}
All partial declarations are compiled together as one Items class.
This allows custom code to be accessed through the same [TabName].Instance, and you can make static methods from it.
It also allows access to the private variables and methods among the generated members inside the [TabName] class.
For example, Items_Custom.cs could add a helper that gets items below a certain value.Â
public static List<EItem> GetAffordableItems(int budget)
{
  List<EItem> affordableItems = new();
  foreach (EItem item in RowIteration)
    if (Value(item) <= budget)
      affordableItems.Add(item);
  return affordableItems;
}
RowIteration is generated by GHUD and iterates the valid item rows in row order while skipping None.
Value(item) is the generated accessor for the sheet-backed Value column.
Game code can then use the helper directly with Items.GetAffordableItems:
List<EItem> affordableItems = Items.GetAffordableItems(player.money);
While row specific data and assets can be added to the Data Tabs through the Google Sheets and the Asset Loaders,
You may want to add general or misc serialized fields to the Data Tabs.
This is another use for custom partial tab classes.
From a user made partial class we can add a serialized field.
In the example above, we serialize an ItemDrop component reference and assign the ItemDrop component from a prefab in the Data Tab.
If we made this variable public, it could be accessed through
Items.Instance.itemDropPrefab
We can also make a static method to both provide and initialize it.
Then the prefab can be accessed through something like Items.SpawnItemDrop([parameters])