C.4 Enemies
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 Enemy Definition
-
In your Unity Project window, create a new folder for your enemy.
- Example:
PathToContentContainer/Content/Enemies/MyEnemy.
- Example:
-
Inside that folder, create another folder named Registry.
- Example:
PathToContentContainer/Content/Enemies/MyEnemy/Registry.
- Example:
-
Inside the Registry folder, right-click and select:
Create → DawnLib → Definitions → Dusk Enemy Definition. -
Configure the Namespace and Key for your enemy.
- Example:
code_rebirth:redwood_titan.
- Example:
Configuring the DuskEnemyDefinition
Once you’ve created the DuskEnemyDefinition, several fields will need to be filled in.
Required Fields
| Field | Description |
|---|---|
| Config Entries | A place you can create optional configuration entries for the item. |
| Namespace / Key | Unique identifiers for your enemy (e.g., code_rebirth:redwood_titan). |
| EnemyType | Assign your existing EnemyType ScriptableObject here (should already be configured). |
| Spawn Tables | Define which spawn tables your enemy can appear in. |
| Bestiary Text (optional) | Custom description text for your enemy in the bestiary. |
| Bestiary Trigger Override (optional) | Overrides the word that triggers the bestiary entry (defaults to enemy name). |
Configuring Enemy Weights
You can control how often your enemy spawns 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. |
| MaxAmount / PowerLevel Configs | Automatically generated and cannot currently be disabled. |
Organizing and Bundling
After your enemy and definitions are configured:
-
Put your DuskEnemyDefinition, EnemyType, and all related assets into a single AssetBundle.
- Example:
redwoodtitanassets.
- Example:
-
Add this AssetBundle to the list of AssetBundles in your ContentContainer
(created during the Unity Setup stage).
Once that’s done, your enemy is registered!
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