C.7 Items

Updated a month ago

Code Setup

  • TBD

Editor Setup

DISCLAIMER
This page assumes you have already set up Unity and completed the following two pages:

If you have not completed those steps, please do so before continuing.


Creating Your Item Definition

  1. In your Unity Project window, create a new folder for your item.

    • Example: PathToContentContainer/Content/Items/MyItem.
  2. Inside that folder, create another folder named Registry.

    • Example: PathToContentContainer/Content/Items/MyItem/Registry.
  3. Inside the Registry folder, right-click and select: Create → DawnLib → Definitions → Dusk Item Definition.

  4. Before continuing, ensure you have prepared:

    • A valid Item ScriptableObject with the necessary vanilla-style references configured.
    • Any prefabs, meshes, icons, audio clips, and scripts used by the item.

Configuring the DuskItemDefinition

Once you’ve created the DuskItemDefinition, several fields will need to be filled in.

Required Fields

Field Description
Config Entries Allows you to create configuration entries for the item to access via code.
Tags Assign your content some tags
Namespace Unique identifier prefix for your content. Example: code_rebirth.
Key Becomes autofilled in by reading the itemName in your Item.
Item Assign your Item ScriptableObject here.
Shop Item Preset
Terminal Predicate
Pricing Strategy

Configuring Item Weights

You can control how often your itemspawns and how it interacts with spawn multipliers.
By default, all values are neutral, as in have no effect, additions are set to 0 and multipliers are set to 1.

  • Adjust or remove defaults as needed.
  • Follow the format shown in each field’s header when customizing weights.
  • You're able to do this for moons, weathers and interiors.

Config Generation Options

You can toggle which configuration files will be generated for users:

Option Description
Generate Spawn Weights Config Allows users to modify spawn weights.
IsScrap / Generate Scrap Config
IsShopItem / Generate Shop Item Config
Cost
Generate Disable Unlock Config
Generate Disable Pricing Strategy Config

Organizing and Bundling

After your item and definition are configured:

  1. Put your DuskItemDefinition, Item ScriptableObject, and all related assets into a single AssetBundle.

    • Example: wayfarerwalletassets.
  2. Add this AssetBundle to the list of AssetBundles in your ContentContainer (created during Unity Setup).

Once this is done, your item is registered and ready to load in-game.


Final Notes

Remember: You can always contact @xuxiaolan on Discord for support, either through the Lethal Modding server or via direct messages, if you encounter any issues or have questions.