Creating Custom Objects
This section of the guide is for mod developers to add their own objects to Architect, so requires knowledge of Hollow Knight mod development.
Other Hollow Knight mods can also register their own custom objects with Architect, allowing you to place them down in the world too!
This is done by registering your own Content Pack containing your own objects, which adds them to the GUI to be selected.
First, create a Content Pack using new ContentPack(name, description)
For example:
var customs = new ContentPack("My mod", "Assets from My Mod")
Next, make a PackElement
object to add to your content pack. The simplest way to do this is with a SimplePackElement
, which requires the object, name, category and a sprite for when placing the object down.
If you do not specify a sprite, Architect will attempt to retrieve one from the sprite renderer of the object. If your object does not contain a Sprite Renderer, make sure you specify a Sprite in the pack element, or you will encounter issues.
Example:
var myElement = new SimplePackElement(object, "My Object", "My Category", sprite);
Once you have a pack element, you must add it to the content pack. To do this you can either use Add()
, or use the list initializer like this:
var customs = new ContentPack("My mod", "Assets from My Mod")
{
new SimplePackElement(object, "My Object", "My Category", sprite)
};
Finally, register your custom Content Pack with Architect to add all the elements to the UI.
ContentPacks.RegisterPack(customs);
Here's a full example of a custom content pack:
var customs = new ContentPack("Custom", "Custom assets that don't exist in the base game")
{
new SimplePackElement(CreateHazardRespawnPoint(), "Hazard Respawn Point", "Custom", WeSpriteUtils.Load("hazard_respawn_point")),
new SimplePackElement(CreateZoteTrophy(), "Winner's Trophy", "Custom")
};
ContentPacks.RegisterPack(customs);
Last updated