Skip to main content
Version: 1.26.132

Category Creation Functions

This is just a simple list of category creation functions, They can create Factory, Recipe, Module, and Item Categories.

Factory

private void CreateFactoryCategory(string name, string categoryId)
{
var category = ScriptableObject.CreateInstance<FactoryType>();
category.name = name;
var guid = GUID.Parse(categoryId);
AssetReference[] assets = new AssetReference[] { new AssetReference() { Object = category, Guid = guid, Labels = new string[0] } };
RuntimeAssetStorage.Add(assets);
}

Module

private void CreateModuleCategory(string name, string categoryId)
{
var category = ScriptableObject.CreateInstance<ModuleCategory>();
category.name = name;
var guid = GUID.Parse(categoryId);
AssetReference[] assets = new AssetReference[] { new AssetReference() { Object = category, Guid = guid, Labels = new string[0] } };
RuntimeAssetStorage.Add(assets);
}

Recipe

private void CreateRecipeCategory(string name, string categoryId)
{
var category = ScriptableObject.CreateInstance<RecipeCategory>();
category.name = name;
var guid = GUID.Parse(categoryId);
AssetReference[] assets = new AssetReference[] { new AssetReference() { Object = category, Guid = guid, Labels = new string[0] } };
RuntimeAssetStorage.Add(assets);
}

Item

private void CreateItemCategory(string name, string categoryId)
{
var category = ScriptableObject.CreateInstance<ItemCategory>();
category.name = name;
var guid = GUID.Parse(categoryId);
AssetReference[] assets = new AssetReference[] { new AssetReference() { Object = category, Guid = guid, Labels = new string[0] } };
RuntimeAssetStorage.Add(assets);
}