C.7 Items
Updated a month agoCode 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
-
In your Unity Project window, create a new folder for your item.
- Example:
PathToContentContainer/Content/Items/MyItem.
- Example:
-
Inside that folder, create another folder named Registry.
- Example:
PathToContentContainer/Content/Items/MyItem/Registry.
- Example:
-
Inside the Registry folder, right-click and select: Create → DawnLib → Definitions → Dusk Item Definition.
-
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:
-
Put your DuskItemDefinition, Item ScriptableObject, and all related assets into a single AssetBundle.
- Example:
wayfarerwalletassets.
- Example:
-
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.
Pages
- A. Unity Setup
- B.1 Registering Content via Code
- B.2 Registering via Unity Editor
- C.1 Moons
- C.2 Interiors
- C.3 Weathers
- C.4 Enemies
- C.5 Inside/Outside Hazards
- C.6 Ship Upgrades/Decors
- C.7 Items
- C.8 Additional TileSets
- D.1 Achievements
- D.2 Vehicles
- D.3 Entity Replacements
- E.1 DawnLib SourceGenerator
- F.1 Utility Scripts
- F.2 Unity Editor Tricks