From 3D Asset to Working Worktable: Difference between revisions

From Eco - English Wiki
[unchecked revision][unchecked revision]
WugWugg (talk | contribs)
m Giving up for now.
WugWugg (talk | contribs)
Creating the world object, Preparing the 3D asset is good.
Line 49: Line 49:
[[File:Eco - Unity - View Modes.png|thumb|Underlined in red are the different draw mode buttons. <u>4/20/26</u>]]
[[File:Eco - Unity - View Modes.png|thumb|Underlined in red are the different draw mode buttons. <u>4/20/26</u>]]
If something seems off, check the different draw modes and see if changing those allow the scene to render as expected (see picture).
If something seems off, check the different draw modes and see if changing those allow the scene to render as expected (see picture).
With all that setup, it's time to get to the creation parts.


= Creating The Worktable =
= Creating The Worktable =
Line 64: Line 62:
=== Item Icon ===
=== Item Icon ===
[[File:TeamstersStall - StallOnly - 256x256.png|thumb|A large (256x256px) icon created of Stall4 from the medieval assets.]]
[[File:TeamstersStall - StallOnly - 256x256.png|thumb|A large (256x256px) icon created of Stall4 from the medieval assets.]]
This process is also explained here, <code><nowiki>https://mod.io/g/eco/r/origin-points-icon-images-with-blender</nowiki></code>, check it out if you need more visual reference points as that guide has a lot of pictures.
# Open <u>Blender</u>.
# Open <u>Blender</u>.
# Delete everything in the ''Scene Collection''. Find this section in the top-right of the application.
# Delete everything in the ''Scene Collection''. Find this section in the top-right of the application.
Line 71: Line 67:
# Hover ''Import'' to open the sub-menu.
# Hover ''Import'' to open the sub-menu.
# Select the type of 3D asset. For those using medieval assets, select ''FBX (.fbx)''.
# Select the type of 3D asset. For those using medieval assets, select ''FBX (.fbx)''.
# Find the asset on the computer...
# Find the asset on the computer...<br>'''Tip:''' Use Unity to find the <code>.fbx</code> asset.  
## Tip: Use Unity to find the <code>.fbx</code> asset. For the medieval assets, that's in <code>Assets/PolyRonin/Medieval Market Stalls/Meshes/medieval-market-stalls-1.fbx</code>.
## For the medieval assets, that's in <code>Assets/PolyRonin/Medieval Market Stalls/Meshes/medieval-market-stalls-1.fbx</code>.
## Right click on it and select ''Show in explorer''.
## Right click on it and select ''Show in explorer''.
## Now copy the address of that folder from Explorer. It might look like <code>C:\Users\Wug\EcoMod--WikiDemo\WikiDemo\Assets\PolyRonin\Medieval Market Stalls\Meshes</code>.
## Now copy the address of that folder from Explorer. It might look like <code>C:\Users\Wug\EcoMod--WikiDemo\WikiDemo\Assets\PolyRonin\Medieval Market Stalls\Meshes</code>.
## Paste that in the address bar of the <u>Blender</u> import pop-up.
## Paste that in the address bar of the <u>Blender</u> import pop-up.
# Select the blue ''Import FBX'' button''.''
# Select the blue ''Import FBX'' button''.''
# From ''Layout'' mode, change the Viewport Shading to Material Preview or Rendered. This is on the second toolbar down, far right of center, but before ''Scene Collection'' section.
# Be in the ''Layout'' workspace (top toolbar) and in the ''Object Mode...''
## Find the drop down in the second toolbar from the top that has options like ''Object Mode, Edit Mode, Sculpt Mode,'' etc.
## Select ''Object Mode'' from that drop down.
# Change the Viewport Shading to Material Preview or Rendered. This is on the second toolbar down, far right of center, but before ''Scene Collection'' section.
# If you see purple models, Blender will need help finding textures for these meshes...
# If you see purple models, Blender will need help finding textures for these meshes...
## From the top toolbar, open the ''File'' drop down.
## From the top toolbar, open the ''File'' drop down.
Line 85: Line 84:
## The proper textures/materials should have now loaded in. If it hasn't, consult Google because without the textures the following steps won't produce a usable icon.
## The proper textures/materials should have now loaded in. If it hasn't, consult Google because without the textures the following steps won't produce a usable icon.
# Add a source of light...
# Add a source of light...
## Make sure the editor is in the ''Layout'' mode by checking the top most toolbar.
## Still be in the ''Layout'' workspace (top toolbar) and in the ''Object Mode...''
### Find the drop down in the second toolbar from the top that has options like ''Object Mode, Edit Mode, Sculpt Mode,'' etc.
### Select ''Object Mode'' from that drop down.
## From the toolbar just under that one, find and open the ''Add'' drop down.
## From the toolbar just under that one, find and open the ''Add'' drop down.
## Hover ''Light'' to open that sub-menu.
## Hover ''Light'' to open that sub-menu.
## Click ''Sun''.
## Click ''Sun''.
# Add a camera...
# Add a camera...
## Again make sure the editor is in the ''Layout'' mode.
## In the ''Layout'' workspace (top toolbar) and in the ''Object Mode...''
### Find the drop down in the second toolbar from the top that has options like ''Object Mode, Edit Mode, Sculpt Mode,'' etc.
### Select ''Object Mode'' from that drop down.
## From the second toolbar down, find and open the ''Add'' drop down.
## From the second toolbar down, find and open the ''Add'' drop down.
## Select ''Camera''.
## Select ''Camera''.
# Setup the scene with the object placement and lighting direction desired. '''Tip:''' To reset the editor to something selected press the period key <u>on the numpad</u>. Without a numpad, use ''View'' (second toolbar from the top) and select ''Frame Selected'' from it. Alternatively, just set the zoom to zoom to the mouse position: ''Edit'' (top toolbar), ''Preferences'' (from drop down), ''Navigation'' (on left menu), ''Zoom to Mouse Position'' (In the zoom section). This makes moving around a lot more natural feeling.
# Setup the scene with the object placement and lighting direction desired.<br>'''Tip:''' To reset the editor to something selected press the period key <u>on the numpad</u>. Without a numpad, use ''View'' (second toolbar from the top) and select ''Frame Selected'' from it. Alternatively, just set the zoom to zoom to the mouse position: ''Edit'' (top toolbar), ''Preferences'' (from drop down), ''Navigation'' (on left menu), ''Zoom to Mouse Position'' (In the zoom section). This makes moving around a lot more natural feeling.
# Setup the rendering camera...
# Setup the rendering camera...
## Go to ''Rendering''  tab on the top toolbar
## Go to ''Rendering''  tab on the top toolbar
Line 105: Line 108:
# Center your view on the object (numpad period or ''View > Frame Selected''). Adjust it so that the object is how it should be for the icon.
# Center your view on the object (numpad period or ''View > Frame Selected''). Adjust it so that the object is how it should be for the icon.
# Align the camera to the view...
# Align the camera to the view...
## Make sure the editor is in ''Layout'' mode (top toolbar).
## Make sure the editor is in ''Layout'' workspace (top toolbar) and in the ''Object Mode...''
### Find the drop down in the second toolbar from the top that has options like ''Object Mode, Edit Mode, Sculpt Mode,'' etc.
### Select ''Object Mode'' from that drop down.
## Find ''View'' from the second from the top toolbar and open the drop down.
## Find ''View'' from the second from the top toolbar and open the drop down.
## Hover ''Align View'' to open the sub-menu.
## Hover ''Align View'' to open the sub-menu.
Line 158: Line 163:
# Right click on the ''ItemTemplate'' object and select ''Rename''. Name this what you want the item to be called. Example: ''MedievalStallItem''.
# Right click on the ''ItemTemplate'' object and select ''Rename''. Name this what you want the item to be called. Example: ''MedievalStallItem''.
# Set this item's background...
# Set this item's background...
## Here's the default backgrounds (blue = item, brown = block, green = food): [[File:Eco - Item - Background.png|border|frameless]]        [[File:Eco - Block - Background.png|frameless]]        [[File:Eco - Food - Background.png|frameless]]
## Here's the default backgrounds (blue = item, brown = block, green = food): <br>[[File:Eco - Item - Background.png|border|frameless]]        [[File:Eco - Block - Background.png|frameless]]        [[File:Eco - Food - Background.png|frameless]]
## Download or prepare the background and add it to the <code>Assets</code> folder in Unity.  
## Download or prepare the background and add it to the <code>Assets</code> folder in Unity.  
### To follow along lockstep, put the background in a new <code>Assets/WikiDemo</code> folder.
### To follow along lockstep, put the background in a new <code>Assets/WikiDemo</code> folder.
Line 207: Line 212:


# Open the ''File'' menu from the top toolbar.
# Open the ''File'' menu from the top toolbar.
# Select ''Save.'' Save it to the <code>Assets/WikiDemo</code> folder. '''Note:''' Do not skip. The scene must be saved for the ModKit build to work properly.
# Select ''Save.'' Save it to the <code>Assets/WikiDemo</code> folder.<br>'''Note:''' Do not skip. The scene must be saved for the ModKit build to work properly.
# Open the ''Eco Tools'' menu from the top toolbar.
# Open the ''Eco Tools'' menu from the top toolbar.
# Hover ''Mod Kit'' to open the sub-menu.
# Hover ''Mod Kit'' to open the sub-menu.
Line 215: Line 220:


=== Scripting the Item ===
=== Scripting the Item ===
For a more complex mod, it would be wise to build it into a DLL. See [[Getting Started with Eco Modding in Visual Studio 2022]] for details on that.
For this guide, all code will be placed in a single <code>.cs</code> file and will not be compiled into a <code>.dll</code>.


# Create a <code>.cs</code> file: <code>/Eco Server/Mods/UserCode/WikiDemo.cs</code>
# Create a <code>.cs</code> file: <code>/Eco Server/Mods/UserCode/WikiDemo.cs</code>
Line 238: Line 243:
'''Line 13:''' The implementation of <code>Item</code> means that Eco will find this and look for Unity assets that matching this class' name, <code>MedivalStallItem</code>. While this doesn't do anything fancy, it completes the first step towards a new workbench.
'''Line 13:''' The implementation of <code>Item</code> means that Eco will find this and look for Unity assets that matching this class' name, <code>MedivalStallItem</code>. While this doesn't do anything fancy, it completes the first step towards a new workbench.


=== Checkpoint ===
=== Checkpoint #1 ===
[[File:Eco - Hotbar With Modded Icon.png|thumb|Shows the medieval stall as a modded icon in-game.]]
[[File:Eco - Hotbar With Modded Icon.png|thumb|Shows the medieval stall as a modded icon in-game.]]
This was a lot of setup and steps. Make sure everything is running smoothly by doing the following:
Make sure everything is running smoothly by doing the following:


# Double-check that the <code>WikiDemo.unity3d</code> and the <code>WikiDemo.cs</code> files are in <code>/Eco Server/Mods/UserCode</code> folder.
# Double-check that the <code>WikiDemo.unity3d</code> and the <code>WikiDemo.cs</code> files are in <code>/Eco Server/Mods/UserCode</code> folder.
# Start the server and connect to it.
# Start the server and connect to it.
# Test it out by typing <code>/give MedievalStall</code> in chat
# Test it out by typing <code>/give MedievalStall</code> in chat.
## It's also possible to do <code>/give Market Stall</code> to get the item. How? Line 10: of the the above code declares that name as this item's "common name". Neat.
## It's also possible to do <code>/give Market Stall</code> to get the item. How? Line 10: of the the above code declares that name as this item's "common name". Neat.
# The item should appear in the players inventory with a working icon.
# The item should appear in the players inventory with a working icon.
This was the longest "leg" of this journey. All the setup is done and the infrastructure is in place. The following sections will just build on what was taught here.
Keep on, keeping on!


== Code the Item's Recipe ==
== Code the Item's Recipe ==
This section will be much simpler than the last. The following goes over how to add a new class and implement the <code>RecipeFamily</code> interface.<syntaxhighlight lang="c#" line="1">using Eco.Core.Items;
The following goes over how to add a new class and implement the <code>RecipeFamily</code> interface.<syntaxhighlight lang="c#" line="1">using Eco.Core.Items;
using Eco.Gameplay.Components;
using Eco.Gameplay.Components;
using Eco.Gameplay.Items;
using Eco.Gameplay.Items;
Line 320: Line 321:
'''Line 21:''' <code>[SupportedOSPlatform("windows7.0")]</code> is here to silence some annoying warnings in Visual Studio. It's optional.
'''Line 21:''' <code>[SupportedOSPlatform("windows7.0")]</code> is here to silence some annoying warnings in Visual Studio. It's optional.


'''Line 30-32:''' Declares the input ingredients used for crafting. <code>typeof(Skill)</code> gets mapped to the <code>CarpentrySkill</code> as defined by line 31. In this example the <code>HempMooringRope</code> is a static input. A static input will not be modified by skills, upgrade modules, or game settings. '''Note:''' It seems that at the time of writing (4/21/2026, Eco v13.0.2) the only way to get an ingredient to be a dynamic value that is reduced by the table's upgrade is to pass <code>typeof(Skill)</code> to it; Passing either <code>true</code> or <code>false</code> makes the this input static.
'''Line 30-32:''' Declares the input ingredients used for crafting. <code>typeof(Skill)</code> gets mapped to the <code>CarpentrySkill</code> as defined by line 31. In this example the <code>HempMooringRope</code> is a static input. A static input will not be modified by skills, upgrade modules, or game settings.<br>'''Note:''' It seems that at the time of writing (4/21/2026, Eco v13.0.2) the only way to get an ingredient to be a dynamic value that is reduced by the table's upgrade is to pass <code>typeof(Skill)</code> to it; Passing either <code>true</code> or <code>false</code> makes the this input static.


'''Line 34:''' The <code>items</code> list declares what items are <u>output</u> by this recipe.
'''Line 34:''' The <code>items</code> list declares what items are <u>output</u> by this recipe.
Line 328: Line 329:
'''Line 40:''' Amount of calories needed to craft this item. For a static value (not modified by upgrades or skill levels) change this line to: <code>this.LaborInCalories = CreateLaborInCaloriesValue(800);</code>. As it's written in the example, this item's calorie cost will be dynamic (modified by upgrades and skill levels). The skill level that will modify it is declared on line 16.
'''Line 40:''' Amount of calories needed to craft this item. For a static value (not modified by upgrades or skill levels) change this line to: <code>this.LaborInCalories = CreateLaborInCaloriesValue(800);</code>. As it's written in the example, this item's calorie cost will be dynamic (modified by upgrades and skill levels). The skill level that will modify it is declared on line 16.


'''Line 41:'''  Minutes needed to craft. Both static and dynamic values for crafting time can be modified by the world difficulty settings. For a static value change this line to: <code>this.CraftMinutes = CreateCraftTimeValue(10f);</code>. As it's written in the example, this item's craft time will be dynamic.'''Line 49:''' This line assigns the recipe to a workbench. <u>Do not assign</u> to itself because then the first table could never be made. It's recommend to use a preexisting vanilla table.
'''Line 41:'''  Minutes needed to craft. Both static and dynamic values for crafting time can be modified by the world difficulty settings. For a static value change this line to: <code>this.CraftMinutes = CreateCraftTimeValue(10f);</code>. As it's written in the example, this item's craft time will be dynamic.
=== Checkpoint ===
 
'''Line 49:''' This line assigns the recipe to a workbench. <u>Do not assign</u> to itself because then the first table could never be made. It's recommend to use a preexisting vanilla table.
=== Checkpoint #2 ===
Check the functionality at this point -- it should be possible to see the recipe in the crafting table.
Check the functionality at this point -- it should be possible to see the recipe in the crafting table.


Line 336: Line 339:
# Type <code>/give Carpentry Table</code>.
# Type <code>/give Carpentry Table</code>.
# Place the Carpentry Table down and interact to see the what can be crafted.
# Place the Carpentry Table down and interact to see the what can be crafted.
# Scroll and find the ''Market Stall'' recipe.
# Find the newly added recipe under the name ''Market Stall.''
# Type <code>/give Basic Upgrade 4</code>.
# Type <code>/give Basic Upgrade 4</code>.
# Put the basic upgrade into the table.
# Put the basic upgrade into the table.
# Go back to the recipe for the ''Market Stall'' and make sure the Wood and the Cotton fabric inputs now require less, but the Hemp Mooring Rope still is the same. '''Note:''' In case the recipe hasn't changed close that table's window and interact with it again. It should for the recipes to refresh now that the upgrade is in it.
# Go back to the recipe for the ''Market Stall'' and make sure the Wood and the Cotton fabric inputs now require less, but the Hemp Mooring Rope still is the same.<br>'''Note:''' In case the recipe hasn't changed close that table's window and interact with it again. It should for the recipes to refresh now that the upgrade is in it.


== Create the World Object ==
== Create the World Object ==
=== Preparing the 3D Asset ===
=== Preparing the 3D Asset ===
WIP. Below is <u>incorrect</u>. The origin point of the object should be a (0.5, 0.5, 0.5). Need to remember to zero out any transforms (translation and rotation) that the world object build scrip applies in Unity.
You must use "override occupancy" for the prefab to be placable. The offset is still magic to me, need to figure that out.
Also the freeplace seems to use the center of the prefab, but the snap place uses the origin. Need to figure out how to use origin for both.
# Open <u>Blender</u>.
# Open <u>Blender</u>.
# Load the 3D object created earlier for icon rendering -- <code>Assets/WikiDemo/MedievalStall - Icon Scene.blend</code>.
# Load the 3D object created earlier for icon rendering -- <code>Assets/WikiDemo/MedievalStall - Icon Scene.blend</code>.
# Cleanup the scene...
# Cleanup the scene...
## Use the scene collection panel on the top-right side of the screen. Select and '''delete any light source'''. These will have a 💡 icon and by default are named something like "sun", "point", "spot" or "area". '''Note:''' If your model is a light source or has one in it, you can leave that light source. The point here is to remove the ambient lights used for icon rendering.
## Delete any light source. Use the ''Scene Collection'' panel on the top-right side of the screen. These will have a 💡 icon and by default are named something like "sun", "point", "spot" or "area".<br>'''Note:''' If your model is a light source or has one in it, you can leave that light source. The point here is to remove the ambient lights used for icon rendering.
## In the scene collection panel, select and '''delete any camera(s)'''. These have a 🎥 icon and by default are named something like "camera".
## Delete any camera(s). Again, use the ''Scene Collection'' panel. These have a 🎥 icon and by default are named something like "camera".
# <u>If there are multiple different 3D assets in the scene</u> (like bags, crates, jars, ect.), join them all together...
# <u>If there are multiple different 3D assets in the scene</u> (like bags, crates, jars, ect.), join them all together...
## Select all of the meshes by holding ''Shift'' and clicking on each one in the ''Scene Collection'' panel (right side of window). '''Tip:''' Quickly select a group of them by selecting one near the top. Then hold ''Shift'', ''Ctrl,'' and click on one near the bottom. This will both the one at the top and the one at the bottom, but also every item in between. Neat!
## Select all of the meshes by holding ''Shift'' and clicking on each one in the ''Scene Collection'' panel (right side of window).<br>'''Tip:''' Quickly select a group of them by selecting one near the top. Then hold ''Shift'', ''Ctrl,'' and click on one near the bottom. This will both the one at the top and the one at the bottom, but also every item in between. Neat!
## Be in ''Layout'' mode (top toolbar).
## Be in ''Layout'' workspace (top toolbar) and in the ''Object Mode...''
### Find the drop down in the second toolbar from the top that has options like ''Object Mode, Edit Mode, Sculpt Mode,'' etc.
### Select ''Object Mode'' from that drop down.
## Find and open the ''Object'' menu (second toolbar down from the top).
## Find and open the ''Object'' menu (second toolbar down from the top).
## Select ''Join''.
## Select ''Join''.
## In the ''Scene Collection'' panel, double click on the name of the newly joined mesh.
## In the ''Scene Collection'' panel, double click on the name of the newly joined mesh.
## Rename it to <code>MedievalStallMesh</code>.
# Rename the joined mesh to <code>MedievalStallMesh</code>.
# Add and position a reference cube...
# Add and position a reference cube...
## Make sure the editor is in ''Layout'' view (top toolbar).
## Make sure the editor is in ''Layout'' view (top toolbar) and in the ''Object Mode...''
### Find the drop down in the second toolbar from the top that has options like ''Object Mode, Edit Mode, Sculpt Mode,'' etc.
### Select ''Object Mode'' from that drop down.
## Then, add a reference cube. Open the ''Add'' menu (second top toolbar down).
## Then, add a reference cube. Open the ''Add'' menu (second top toolbar down).
## Hover ''Mesh''.
## Hover ''Mesh''.
## Select ''Cube.''
## Select ''Cube.''
## Find the ''Properties'' panel. It's just below the ''Scene Collection'' panel on the right side of the window.
## Open the ''View'' menu (second toolbar down).
## Now, still inside that panel but on the left side of it there's a column of icons.
## Select ''Sidebar''.
## Hover them to see their names.
## A new panel will have expanded.
## Find the one that reads:  ''Object'' ''Object Properties'' '''Tip:''' It kinda looks like an orange box
## Along the right side of that panel there's buttons (''Item, Tool, View, Animation''). Find and click the ''Item'' button.
## Find and expand the ''Transform'' section
## Find and expand the ''Transform'' section
## Set ''Location X'' to ''1''.
## Set the ''Location...''
## Just below that, set ''Y'' to ''1''.
### ''X'' to ''1''.
## Just below that, again, set ''Z'' to ''1''.
### ''Y'' to ''1''.
## The bottom corner of the cube will be touching the green and red axis lines.
### ''Z'' to ''1''.
## The bottom corner of the cube should be touching the where green and red axis lines meet.
# Move the reference cube's origin to <code>(0, 0, 0)</code>...
# Move the reference cube's origin to <code>(0, 0, 0)</code>...
## Be in ''Layout'' mode (top toolbar).
## Be in ''Layout'' workspace (top toolbar) and in the ''Object Mode...''
### Find the drop down in the second toolbar from the top that has options like ''Object Mode, Edit Mode, Sculpt Mode,'' etc.
### Select ''Object Mode'' from that drop down.
## Open the ''View'' menu (second toolbar down).
## Open the ''View'' menu (second toolbar down).
## Select ''Sidebar''.
## Select ''Sidebar''.
Line 381: Line 386:
## Along the right side of that panel there's buttons (''Item, Tool, View, Animation''). Find and click the ''View'' button.
## Along the right side of that panel there's buttons (''Item, Tool, View, Animation''). Find and click the ''View'' button.
## Find and expand the ''3D Cursor'' section.
## Find and expand the ''3D Cursor'' section.
## Under ''Location'' set ''X'' to ''0''.
## Set the 3D cursor's ''Location''...
## ''Y'' to 0.
### ''X'' to ''0''.
## ''Z'' to 0.
### ''Y'' to ''0''.
## Now in the ''Scene Collection'' panel, select the ''Cube'' mesh.
### ''Z'' to ''0.''
## Now in the ''Scene Collection'' panel, click on the ''Cube'' mesh to highlight and select it.
## Open the ''Object'' menu from the second toolbar down from the top.
## Open the ''Object'' menu from the second toolbar down from the top.
## Hover ''Set Origin''.
## Hover ''Set Origin''.
## Select ''Origin to 3D Cursor''.
## Select ''Origin to 3D Cursor''.
# Set the reference cube's dimensions...
# Set the reference cube's dimensions...
## Be in ''Layout'' mode, open the ''View'' menu (second toolbar down), and select and expand the ''Sidebar'' option''.''
## Be in ''Layout'' workspace (top toolbar) and in the ''Object Mode...''
## To the right of the sidebar, find and click the ''Item'' button.
### Find the drop down in the second toolbar from the top that has options like ''Object Mode, Edit Mode, Sculpt Mode,'' etc.
### Select ''Object Mode'' from that drop down.
## Open the ''View'' menu (second toolbar down).
## Select and check the ''Sidebar'' option''.''  
## The ''Sidebar'' menu just expanded over on the right side of the screen.
## To the right of the ''Sidebar'', find and click the ''Item'' button.
## Expand the ''Transform'' section.
## Expand the ''Transform'' section.
## Find the ''Dimensions,'' and set ''X'' to ''4''.
## Set the ''Dimensions...'''''<br>Note:''' These dimensions only make sense for the asset being used for this guide. If using a different one, set the dimensions to the size of the box that model should fit in.
## ''Y'' to ''3''.
### ''X'' to ''4''.
## ''Z'' to ''3''.  '''Note:''' These dimensions only make sense for the asset being used for this guide. If using a different one, set the dimensions to the size of the box that model should fit in
### ''Y'' to ''3''.
# Adjust the position and scale to fit inside a box. This is important because it ensures that this object won't clip into other objects when placed.
### ''Z'' to ''3''.
## Be in ''Layout'' mode (top toolbar).
# Adjust the position and scale of the ''MedievalStallMesh'' to fit inside a box.
## Find the drop down in the second toolbar from the top that has options like ''Object Mode, Edit Mode, Sculpt Mode,'' etc.
## Be in ''Layout'' workspace (top toolbar) and in the ''Object Mode...''
## Select ''Object Mode'' from that drop down.
### Find the drop down in the second toolbar from the top that has options like ''Object Mode, Edit Mode, Sculpt Mode,'' etc.
### Select ''Object Mode'' from that drop down.
## On the left side of the screen there's a column of icons. Hover over them to see their names.
## On the left side of the screen there's a column of icons. Hover over them to see their names.
## Select the ''Move'' tool.
## Select the ''Move'' tool.
## Click on the Medieval Stall to select it. Zoom out and reposition the camera so that the blue, green, and red arrows are visible. '''Tip:''' By holding the middle-mouse button and dragging the scene will rotate. By holding the middle-mouse button and the ''Shift'' key, the scene will pan. '''Tip:''' If panning or rotating the scene becomes slow or frustrating (especially after zooming), try selecting 3D asset from the ''Scene Collection'' panel, opening the ''View'' menu (second toolbar from top), and selecting ''Frame Selected''. This will reset the view onto that object and controls should feel normal again.
## Click on the Medieval Stall to select it. Zoom out and reposition the camera so that the blue, green, and red arrows are visible.<br>'''Tip:''' By holding the middle-mouse button and dragging the scene will rotate. By holding the middle-mouse button and the ''Shift'' key, the scene will pan.<br>'''Tip:''' If panning or rotating the scene becomes slow or frustrating (especially after zooming), try selecting 3D asset from the ''Scene Collection'' panel, opening the ''View'' menu (second toolbar from top), and selecting ''Frame Selected''. This will reset the view onto that object and controls should feel normal again.
## Click and hold one of the arrows. Move the mouse to drag the 3D asset towards the box.
## Click and hold one of the arrows. Move the mouse to drag the 3D asset towards the box.
## Move the 3D asset around till it's <u>completely inside the box</u>. If it cannot fit and is too big, continue to the next step. '''Tip:''' To select the 3D asset once it disappears, use the ''Scene Collection'' panel. Click on it there and the blue, green, and red arrows will show up again for it.   '''Tip:''' There are preset views. To use them go to the ''View'' menu (second toolbar from top)'','' hover ''Viewpoint'', and select the view that would be most helpful.
## Move the 3D asset around till it's <u>completely inside the box</u>. If it cannot fit and is too big, continue to the next step.<br>'''Tip:''' To select the 3D asset once it disappears, use the ''Scene Collection'' panel. Click on it there and the blue, green, and red arrows will show up again for it.<br>'''Tip:''' There are preset views. To use them go to the ''View'' menu (second toolbar from top)'','' hover ''Viewpoint'', and select the view that would be most helpful.
## Find the ''Scale'' tool from the left side of the screen.
## Find the ''Scale'' tool from the left side of the screen.
## Now the blue, green, and red "arrows" don't really look like arrows anymore. They are lines with boxes at the end.
## Now the blue, green, and red "arrows" don't really look like arrows anymore. They are lines with boxes at the end.
## Click and hold on those lines to adjust the scale of the 3D asset to make it fit inside the box. '''Tip:''' There are little colored boxes in between the lines that can be dragged to scale the 3D asset more proportionally.
## Click and hold on those lines to adjust the scale of the 3D asset to make it fit inside the box.<br>'''Tip:''' There are little colored boxes in between the lines that can be dragged to scale the 3D asset more proportionally.
## Continue using the ''Move'' and ''Scale'' tools till the model fits. This will take patience and time. '''Tip:''' Hide the reference cube to see what is happening with the 3D asset. Go to the ''Scene Collections'' panel and click the 👁 button to hide it. Click that button again to show it.
## Continue using the ''Move'' and ''Scale'' tools till the model fits. This will take patience and time.<br>'''Tip:''' Hide the reference cube to see what is happening with the 3D asset. Go to the ''Scene Collections'' panel and click the 👁 button to hide it. Click that button again to show it.
# Now set the 3D asset's origin point... <!-- I still need to determine where the origin point should be based on occupancy code. -->
# Move the reference cube's origin to <code>(0.5, 0.5, 0.5)</code>...
## Ensure that the 3D Cursor is still at <code>(0,0,0)</code>: Open the ''View'' menu (second toolbar down), select and expand the ''Sidebar'', click the ''View'' button (right side of the Sidebar), find and expand the ''3D cursor'' section, change the ''Location X, Y,'' and ''Z'' to ''0''.
## Be in ''Layout'' workspace (top toolbar) and in the ''Object Mode...''
## Select the 3D asset using the ''Scene Collection'' panel.
### Find the drop down in the second toolbar from the top that has options like ''Object Mode, Edit Mode, Sculpt Mode,'' etc.
### Select ''Object Mode'' from that drop down.
## Open the ''View'' menu (second toolbar down).
## Select ''Sidebar''.
## A new panel will have expanded.
## Along the right side of that panel there's buttons (''Item, Tool, View, Animation''). Find and click the ''View'' button.
## Find and expand the ''3D Cursor'' section.
## Set the 3D cursor's ''Location''...
### ''X'' to ''0''.5.
### ''Y'' to ''0.5''.
### ''Z'' to ''0.5.''
## Select the ''MedievalStallMesh'' using the ''Scene Collection'' panel.
## Open the ''Object'' menu (second toolbar down).
## Open the ''Object'' menu (second toolbar down).
## Hover ''Set Origin''.
## Hover ''Set Origin''.
## Select ''Origin to 3D Cursor''.
## Select ''Origin to 3D Cursor''.
# Select the reference cube from the ''Scene Collections'' panel.
# Select the reference cube named ''Cube'' from the ''Scene Collections'' panel.
# Open ''Object'' menu (second toolbar down).
# Open ''Object'' menu (second toolbar down).
# Select ''Delete''.
# Select ''Delete''.
# Move the ''MedievalStallMesh'' to <code>(0, 0, 0)</code>...
## Be in ''Layout'' workspace (top toolbar) and in the ''Object Mode...''
### Find the drop down in the second toolbar from the top that has options like ''Object Mode, Edit Mode, Sculpt Mode,'' etc.
### Select ''Object Mode'' from that drop down.
## Open the ''View'' menu (second toolbar down).
## Select ''Sidebar''.
## A new panel will have expanded.
## Along the right side of that panel there's buttons (''Item, Tool, View, Animation''). Find and click the ''Item'' button.
## Make sure the ''MedievalStallMesh'' is selected. Use the ''Scene Collection'' panel if needed.
## Find and expand the ''Transform'' section
## Set the ''Location...''
### ''X'' to 0.
### ''Y'' to 0.
### ''Z'' to 0.
# Make sure the ''MedievalStallMesh'' is selected. Use the ''Scene Collection'' panel if needed.
# Open the ''Object'' menu.
# Open the ''Object'' menu.
# Hover ''Apply''.
# Hover ''Apply''.
# Select ''All Transformations''. '''TODO:''' Ensure this step doesn't alter the origin now that it's being place in bottom-center, 0.5m off ground
# Select ''All Transformations''. '''Note:''' This step bakes all of the changes into the mesh. It's very important.
# Open the ''File''  menu from the top toolbar.
# Open the ''File''  menu from the top toolbar.
# Hover ''Export'' to open the sub-menu.
# Hover ''Export'' to open the sub-menu.
Line 429: Line 467:
# In the settings region scroll and find the ''Transform'' section and expand it. Change the following:
# In the settings region scroll and find the ''Transform'' section and expand it. Change the following:
## Find ''Apply Scalings'' and set it to ''FBX All''.
## Find ''Apply Scalings'' and set it to ''FBX All''.
## Just below that find ''Forward'' and set it to ''-Z Forward''.
## Just below that find ''Forward'' and set it to ''Z Forward''.
## Ensure that the next setting down, ''Up'', changed to ''Y Up''.
## Ensure that the next setting down, ''Up'', changed to ''Y Up''.
## Find ''Apply Unit'' and make sure it's checked.
## Find ''Apply Unit'' and make sure it's checked.
Line 435: Line 473:
## Lastly, find ''Apply Transform'' and check it too.
## Lastly, find ''Apply Transform'' and check it too.
# Save it to <code>Assets/WikiDemo/MedievalStall.fbx</code>.
# Save it to <code>Assets/WikiDemo/MedievalStall.fbx</code>.
# Save the <code>.blend</code> file too and close Blender.
# Save the Blender scene...
## ''File'' drop down from top toolbar.
## ''Save As...'' to save the Blender scene to the computer.
## Save it to <code>Assets/WikiDemo/MedievalStall - Eco Ready Scene.blend</code>.


=== Add to Unity Scene ===
=== Add to Unity Scene ===
Line 450: Line 491:
# Notice in the project window that a new <code>.prefab</code> file was created -- <code>MedievalStallObject.prefab</code>
# Notice in the project window that a new <code>.prefab</code> file was created -- <code>MedievalStallObject.prefab</code>
# Select the <code>.prefab</code> file in the project window.
# Select the <code>.prefab</code> file in the project window.
# In the ''Inspector'' window (right side), scroll and find the ''World Object (Script)'' component.
# Select ''Objects'' from ''Hierarchy'' panel (left-side of the window).
# In that component, find the ''Override Occupancy'' checkbox and check it.
# A new field just appeared, ''Size''.
# Set the ''X'' to ''4''.
# ''Y'' to ''3''.
# ''Z'' to ''3.'' '''Note:''' These are the sizes used for the reference cube. If using different sizes make sure you <u>flip the Y and Z coordinates</u> when reading coordinates from Blender. Blender uses a different coordinate system that Unity!
# Select ''Objects'' from ''Hierarchy'' panel.
# Find the ''Modkit Prefab Container (Script)'' component.
# Find the ''Modkit Prefab Container (Script)'' component.
# Expand the ''Prefabs'' section in that component.
# Expand the ''Prefabs'' section in that component.
Line 463: Line 498:
## Click the ''⦿'' button, switch to the ''Assets'' tab, find or search for ''MedievalStallObject'', and double click on it. Make sure it's the medieval stall <u>object</u> with the <code>.prefab</code> ending.
## Click the ''⦿'' button, switch to the ''Assets'' tab, find or search for ''MedievalStallObject'', and double click on it. Make sure it's the medieval stall <u>object</u> with the <code>.prefab</code> ending.
## Drag the <code>.prefab</code> file onto the ''⦿'' button
## Drag the <code>.prefab</code> file onto the ''⦿'' button
#
# Open the ''File'' menu from top toolbar and select ''Save''.<br>'''Note:''' Do not skip. The scene must be saved for the ModKit build to work properly.
# Open the ''File'' menu from top toolbar and select ''Save''. '''Note:''' Do not skip. The scene must be saved for the ModKit build to work properly.
# Open the ''Eco Tools'' menu from the top toolbar.
# Open the ''Eco Tools'' menu from the top toolbar.
# Hover ''Mod Kit''.
# Hover ''Mod Kit''.
Line 517: Line 551:


=== Checkpoint ===
=== Checkpoint ===
'''Warning:''' In ''Eco'' v13.0.2, free-placed objects may display misaligned ghost cubes, even when configured correctly in your mod. This is a visual-only base-game bug—placement still works as expected, even if the object appears red near edges. <!-- See: https://github.com/StrangeLoopGames/EcoIssues/issues/25834 -->
Export and see what it does. Ensure it's not lifting off the ground because of a non-curved shader.
Export and see what it does. Ensure it's not lifting off the ground because of a non-curved shader.



Revision as of 23:29, 28 April 2026

Introduction

Below is a guide on how to take an 3D asset from the Unity Store and make a working workbench in Eco. This includes:

  • Creating a recipe to craft the modded table
  • Creating recipes so the player can use the modded table to craft something
  • Using Blender to generate a modded icon (seen when holding it in inventory)
  • Using Blender to adjust the origin point of the model
  • How to setup all this in a Unity scene and package for Eco

Setup

  • Already have setup ModKit + Unity
  • Have a 3D model
    • Just following along? Find the one used here at https://assetstore.unity.com/packages/3d/props/low-poly-medieval-market-stalls-314286
  • A C# IDE (notepad++, Visual Studio, etc.)
    • Highly encouraged to have an Intellisense setup and linked to the Reference Assemblies. Optional, but its really worth the time to figure out because it will help quickly correct small typos and trivial mistakes.
    • See: Getting Started with Eco Modding in Visual Studio 2022 (generally the same steps apply if using a new version of Visual Studio)
  • Blender installed
    • Homepage: https://www.blender.org/

Importing the Assets

  1. Open the Unity editor to the project.
  2. From the top toolbar open the Window drop down.
  3. Hover Package Management to open sub-menu.
  4. Select Package Manager.
  5. The Package Manager window will pop-up.
  6. Install the package containing the assets you want to use...
    1. If not using Unity Registry...
      1. Find the +▾ button in the top left and open the drop down.
      2. Install the package from one of those options.
    2. If using Unity Registry...
      1. Visit https://assetstore.unity.com and sign in.
      2. Search for the asset desired.
      3. Go to it's page (e.g. https://assetstore.unity.com/packages/3d/props/low-poly-medieval-market-stalls-314286) and click the big blue button, Add to My Assets.
      4. Now, in the Unity editor and back at the Package Manager window.
      5. Find My Assets on the left menu and navigate to it.
      6. Click the button in the lower-right.
      7. The asset should be in the list now. Use the search to filter if needed.
      8. Click on the asset in the list. For those following along, Low Poly Medieval Market Stalls.
      9. In the right panel, find the Download ⤓ button. Click it.
      10. Once downloaded, a new button should show up, it'll say something like ⊕ Import 1.0 to project . Click it.
      11. The Import Unity Package window will pop-up.
      12. Select Import on it.
  7. Verify you can find your assets from the explorer. If following along, the assets are at Assets/PolyRonin/Medieval Market Stalls.
  8. Load in a demo scene, if provided, and make sure everything looks okay.
    1. For those following along, double click on the Demo scene at Assets/PolyRonin/Medieval Market Stalls/Demo.unity.
Underlined in red are the different draw mode buttons. 4/20/26

If something seems off, check the different draw modes and see if changing those allow the scene to render as expected (see picture).

Creating The Worktable

This guide will create the worktable in this order:

  1. Create the item that represents the worktable
  2. Make a recipe to craft the worktable item
  3. Make the worktable item something that places a world object
  4. Give the worktable functionality by adding recipes to it

Creating the Item

Item Icon

A large (256x256px) icon created of Stall4 from the medieval assets.
  1. Open Blender.
  2. Delete everything in the Scene Collection. Find this section in the top-right of the application.
  3. From the top toolbar, open the File drop down.
  4. Hover Import to open the sub-menu.
  5. Select the type of 3D asset. For those using medieval assets, select FBX (.fbx).
  6. Find the asset on the computer...
    Tip: Use Unity to find the .fbx asset.
    1. For the medieval assets, that's in Assets/PolyRonin/Medieval Market Stalls/Meshes/medieval-market-stalls-1.fbx.
    2. Right click on it and select Show in explorer.
    3. Now copy the address of that folder from Explorer. It might look like C:\Users\Wug\EcoMod--WikiDemo\WikiDemo\Assets\PolyRonin\Medieval Market Stalls\Meshes.
    4. Paste that in the address bar of the Blender import pop-up.
  7. Select the blue Import FBX button.
  8. Be in the Layout workspace (top toolbar) and in the Object Mode...
    1. Find the drop down in the second toolbar from the top that has options like Object Mode, Edit Mode, Sculpt Mode, etc.
    2. Select Object Mode from that drop down.
  9. Change the Viewport Shading to Material Preview or Rendered. This is on the second toolbar down, far right of center, but before Scene Collection section.
  10. If you see purple models, Blender will need help finding textures for these meshes...
    1. From the top toolbar, open the File drop down.
    2. Hover External Data to open the sub-menu.
    3. Select Find Missing Files...
    4. Point this to the whole directory that the 3D assets came in. For the medieval pack, C:\Users\Wug\EcoMod--WikiDemo\WikiDemo\Assets\PolyRonin.
    5. The proper textures/materials should have now loaded in. If it hasn't, consult Google because without the textures the following steps won't produce a usable icon.
  11. Add a source of light...
    1. Still be in the Layout workspace (top toolbar) and in the Object Mode...
      1. Find the drop down in the second toolbar from the top that has options like Object Mode, Edit Mode, Sculpt Mode, etc.
      2. Select Object Mode from that drop down.
    2. From the toolbar just under that one, find and open the Add drop down.
    3. Hover Light to open that sub-menu.
    4. Click Sun.
  12. Add a camera...
    1. In the Layout workspace (top toolbar) and in the Object Mode...
      1. Find the drop down in the second toolbar from the top that has options like Object Mode, Edit Mode, Sculpt Mode, etc.
      2. Select Object Mode from that drop down.
    2. From the second toolbar down, find and open the Add drop down.
    3. Select Camera.
  13. Setup the scene with the object placement and lighting direction desired.
    Tip: To reset the editor to something selected press the period key on the numpad. Without a numpad, use View (second toolbar from the top) and select Frame Selected from it. Alternatively, just set the zoom to zoom to the mouse position: Edit (top toolbar), Preferences (from drop down), Navigation (on left menu), Zoom to Mouse Position (In the zoom section). This makes moving around a lot more natural feeling.
  14. Setup the rendering camera...
    1. Go to Rendering tab on the top toolbar
    2. On the right there will be a side-panel open, it should be the Render tab. Confirm that.
    3. Change Render Engine to Cycles.
    4. Look down below in the same tab for the Film section.
    5. Expand it and find the Transparent checkbox and section. Click it so that it has a check mark. This will make the icon's background transparent.
    6. Now, go to the Output tab on the side panel. The tab is just below the current one.
    7. In the Format section set Resolution X to 64. And Y to 64 as well. This will make the icon generated a 64 by 64 pixel image.
  15. Go back to the Layout tab from the top toolbar.
  16. Center your view on the object (numpad period or View > Frame Selected). Adjust it so that the object is how it should be for the icon.
  17. Align the camera to the view...
    1. Make sure the editor is in Layout workspace (top toolbar) and in the Object Mode...
      1. Find the drop down in the second toolbar from the top that has options like Object Mode, Edit Mode, Sculpt Mode, etc.
      2. Select Object Mode from that drop down.
    2. Find View from the second from the top toolbar and open the drop down.
    3. Hover Align View to open the sub-menu.
    4. Select Align Active Camera To View.
    5. If the view is slightly off, there is a lock icon on the right side of this panel. Use it to "lock" controls to the camera and tweak it's view.
  18. Now return to the Rendering tab from the top toolbar.
  19. Press the F12 key to start the render. This should complete quickly since 64x64 pixels is a very small render.
  20. A window should popup, Blender Render. This is the icon!
  21. From the top tool bar of this Blender Render window, open the Image drop down.
  22. Select Save As... to save somewhere on the computer.
  23. Return to step 13 and repeat to do larger images if desired. Create a 128 by 128 pixel image too. It will make things smoother later.
  24. Save the Blender scene. Not only will it be used later, this will make making a new icon with a small tweak that much easier.
    1. File drop down from top toolbar.
    2. Save As... to save the Blender scene to the computer.
    3. Save it to Assets/WikiDemo/MedievalStall - Icon Scene.blend.

Adding to Unity Scene

The developers explain how to create an item in one of ModKit's read me files (See: Assets/EcoModKit/Docs/README.md), but this guide will explain it below.

Additionally, TheKye on YouTube covers this in their Creating Your First Item and Creating Your First Item Pt 2 videos.

Use those additional resource to help troubleshoot issues with item's icons.

  1. Open Unity.
  2. In the left panel, the Hierarchy tab should be selected.
  3. Select the top-most object there. It should be a scene. If the editor last loaded the Demo scene from the medieval assets, it'll be named Demo.
  4. Right click on this scene and select Add New Scene from the menu.
  5. Right click again on the old scene (Demo) and select Remove Scene.
  6. Let it save if the changes to the old scene are important. Discard if it was open just for exploration's sake.
  7. Right click the new, Untitled scene. Click Save Scene As...
  8. Save it to Assets/WikiDemo.unity.
  9. Delete anything in the scene.
  10. Right click the scene, hover GameObject, and select Create Empty from the sub-menu.
  11. Name this new object Objects.
  12. Select the newly created Objects object from the Hierarchy menu.
  13. On the far right side of the screen, in the Inspector menu, click the Add Component button.
  14. Type in ModkitPrefabContainer. Click on the component from the search to add it. The component now should be listed in the Inspector.
  15. In the Hierarchy panel right click the scene, hover GameObject, and select Create Empty.
  16. Name this new object Items.
  17. Right click the scene, hover GameObject, and select Create Empty.
  18. Name this new object Emoji.
  19. Select the newly created Emoji object, find the Inspector menu (far-right), and click the Add Component button.
  20. Type in ChatEmoteSetOld. Click on the component from the search to add it. That component should now be listed in the Inspector.
  21. Right click the scene, hover GameObject, and select Create Empty.
  22. Name this new object BlockSets.
  23. Select the newly created BlockSets object, find the Inspector menu (far-right), and click Add Component.
  24. Search for BlockSetContainer. Click on the component from the search to add it. The Inspector should now show that component as added.
  25. Go to Assets/EcoModKit/Prefabs in the Unity project window.
  26. Find the prefab ItemTemplate.
  27. Drag it onto the Items object in the Hierarchy panel. It should add it as a child of the Items object.
  28. Right click on the new ItemTemplate object, hover Prefab, and select Unpack Completely.
  29. Right click on the ItemTemplate object and select Rename. Name this what you want the item to be called. Example: MedievalStallItem.
  30. Set this item's background...
    1. Here's the default backgrounds (blue = item, brown = block, green = food):
    2. Download or prepare the background and add it to the Assets folder in Unity.
      1. To follow along lockstep, put the background in a new Assets/WikiDemo folder.
      2. Right click on Assets folder, hover Create, select Folder.
      3. Name the folder WikiDemo.
    3. Configure Unity to use these as sprites...
      1. Select the background(s) added (Ctrl+Click each one).
      2. In the Inspector, find TextureType and change that to Sprite (2D and UI).
      3. Again in the Inspector, find SpriteMode and change that to Single.
      4. Then scroll and go to the bottom of the Inspector and find the Apply button.
      5. This will apply those changes to that file and all other ones highlighted.
    4. Select the item being created (MedievalStallItem).
    5. In the Inspector panel (far-right), scroll and find the Item Template (Script) section.
    6. In here find the Background input. It'll say Background (Image) in it. If clicked that text to reveal and highlight the related object in the Hierarchy panel.
    7. Select the revealed, and highlighted object Background.
    8. In the Inspector panel, scroll and find the Image component section.
    9. Inside that component's section, find Source Image. It'll say Missing (Sprite). Click the ⦿ button to the right.
    10. The Select Sprite popup will show. Make sure the Assets tab is selected, and find the backgrounds desired.
  31. Create the foreground image...
    1. This is easily accomplished in MS Paint.
    2. Get to the background image file in a file explorer.
    3. Right click on it, hover Open with..., and select Paint.
    4. The solid background should be displayed.
    5. Open the File menu from the top toolbar.
    6. Hover Import to Canvas and select From a File.
    7. Find the icon in the file browser and import it. Match the size of the background image to have it nicely center itself.
    8. Now File from the top toolbar.
    9. Hover Save As... and select PNG.
    10. Save this to the Assets/WikiDemo folder in Unity.
    11. Configure Unity to use these as sprites...
      1. Select the foreground image.
      2. In the Inspector, find TextureType and change that to Sprite (2D and UI).
      3. Again in the Inspector, find SpriteMode and change that to Single.
      4. Then scroll and go to the bottom of the Inspector and find the Apply button.
      5. This will apply those changes to that file and all other ones highlighted.
  32. Set this item's foreground...
    1. Copy the item's icon into the Assets folder.
    2. Configure Unity to use it as a sprite (see the previous step's Set this item's background... instructions)
    3. Select the item being created (MedievalStallItem).
    4. In the Inspector panel (far-right), scroll and find the Item Template (Script) section.
    5. In here find the Foreground input. It'll say Foreground (Image) in it. If clicked that text to reveal and highlight the related object in the Hierarchy panel.
    6. Select the revealed, and highlighted object Foreground.
    7. Use the Inspector, find the Image component, within that component find the Source Image input. It will say Missing (Sprite).
    8. Click the ⦿ button to the right of that input.
    9. From the Select Sprite popup, ensure the Assets tab is being searched, and find the icon just created.

Export From Unity

  1. Open the File menu from the top toolbar.
  2. Select Save. Save it to the Assets/WikiDemo folder.
    Note: Do not skip. The scene must be saved for the ModKit build to work properly.
  3. Open the Eco Tools menu from the top toolbar.
  4. Hover Mod Kit to open the sub-menu.
  5. Select Build Current Bundle.
  6. Have it output the bundle to /Eco Server/Mods/UserCode/WikiDemo.unity3d
  7. Wait for this to build. This may take a few minutes.

Scripting the Item

For this guide, all code will be placed in a single .cs file and will not be compiled into a .dll.

  1. Create a .cs file: /Eco Server/Mods/UserCode/WikiDemo.cs
  2. Put the following into the newly created file:
using Eco.Core.Items;
using Eco.Gameplay.Items;
using Eco.Shared.Localization;
using Eco.Shared.Serialization;

namespace WikiDemo
{
    #region Item
    [Serialized] // Tells the save/load system this object needs to be serialized.
    [LocDisplayName("Market Stall")] // Defines the localized name of the item.
    [Weight(100)] // Defines how heavy Arrow is.
    [Ecopedia("Work Stations", "Craft Tables", createAsSubPage: true)]
    [LocDescription("A medieval market stall.")] //The tooltip description for the item.
    public partial class MedievalStallItem: Item { }
    #endregion
}

Line 8: A region tag. Lets the editor know it can collapse all of that code as a section. The following examples in this guide will just show #region Item in their code examples.

Line 13: The implementation of Item means that Eco will find this and look for Unity assets that matching this class' name, MedivalStallItem. While this doesn't do anything fancy, it completes the first step towards a new workbench.

Checkpoint #1

Shows the medieval stall as a modded icon in-game.

Make sure everything is running smoothly by doing the following:

  1. Double-check that the WikiDemo.unity3d and the WikiDemo.cs files are in /Eco Server/Mods/UserCode folder.
  2. Start the server and connect to it.
  3. Test it out by typing /give MedievalStall in chat.
    1. It's also possible to do /give Market Stall to get the item. How? Line 10: of the the above code declares that name as this item's "common name". Neat.
  4. The item should appear in the players inventory with a working icon.

Code the Item's Recipe

The following goes over how to add a new class and implement the RecipeFamily interface.

using Eco.Core.Items;
using Eco.Gameplay.Components;
using Eco.Gameplay.Items;
using Eco.Gameplay.Items.Recipes;
using Eco.Gameplay.Skills;
using Eco.Mods.TechTree;
using Eco.Shared.Localization;
using Eco.Shared.Serialization;
using System.Runtime.Versioning;
using System.Collections.Generic;

namespace WikiDemo
{
    #region Item

    #region Recipe
    [RequiresSkill(typeof(CarpentrySkill), 3)]
    [Ecopedia("Work Stations", "Craft Tables", subPageName: "Market Stall")]
    public partial class MedievalStallRecipe : RecipeFamily
    {
        [SupportedOSPlatform("windows7.0")]
        public MedievalStallRecipe()
        {
            var recipe = new Recipe();
            recipe.Init(
                name: "MedievalStallItem",
                displayName: Localizer.DoStr("Market Stall"),
                ingredients: new List<IngredientElement>
                {
                    new IngredientElement("Wood", 40, typeof(Skill)),
                    new IngredientElement(typeof(CottonFabricItem), 30, typeof(Skill)),
                    new IngredientElement(typeof(HempMooringRopeItem), 5, true)
                },
                items: new List<CraftingElement>
                {
                    new CraftingElement<MedievalStallItem>(1)
                }
            );
            this.Recipes = new List<Recipe> { recipe };
            this.LaborInCalories = CreateLaborInCaloriesValue(800, typeof(Skill));
            this.CraftMinutes = CreateCraftTimeValue(typeof(MedievalStallRecipe), 10f, typeof(Skill));
    
            // Perform pre/post initialization for user mods and initialize our recipe instance with the display name "Market Stall"
            this.ModsPreInitialize();
            this.Initialize(displayText: Localizer.DoStr("Market Stall"), recipeType: typeof(MedievalStallRecipe));
            this.ModsPostInitialize();
    
            // Register our RecipeFamily instance to a work table (in this case the Carpentry Table) so it can be crafted.
            CraftingComponent.AddRecipe(tableType: typeof(CarpentryTableObject), recipeFamily: this); // NOTE: The table must be the object instance!
        }
    
    
        /// <summary>Hook for other mods to customize RecipeFamily before initialization.</summary>
        partial void ModsPreInitialize();
    
        /// <summary>Hook for other mods to customize RecipeFamily after initialization, but before registration. You can change skill requirements here.</summary>
        partial void ModsPostInitialize();
    }
    #endregion
}

Line 10: Eco will need this explicitly added to the file. Visual Studio will not add this line automatically. It's used for the List<T> objects found in this code.

Line 14: "Collapsed" Item section. See the earlier sections in this guide for the code that belongs there.

Line 17: Sets the required skill and skill level to craft this recipe.

Line 21: [SupportedOSPlatform("windows7.0")] is here to silence some annoying warnings in Visual Studio. It's optional.

Line 30-32: Declares the input ingredients used for crafting. typeof(Skill) gets mapped to the CarpentrySkill as defined by line 31. In this example the HempMooringRope is a static input. A static input will not be modified by skills, upgrade modules, or game settings.
Note: It seems that at the time of writing (4/21/2026, Eco v13.0.2) the only way to get an ingredient to be a dynamic value that is reduced by the table's upgrade is to pass typeof(Skill) to it; Passing either true or false makes the this input static.

Line 34: The items list declares what items are output by this recipe.

Line 36: This line declares that one medieval stall is output from this recipe. Functionally this links this recipe to the MedievalStallItem (aka "Market Stall") item created in the last step.

Line 40: Amount of calories needed to craft this item. For a static value (not modified by upgrades or skill levels) change this line to: this.LaborInCalories = CreateLaborInCaloriesValue(800);. As it's written in the example, this item's calorie cost will be dynamic (modified by upgrades and skill levels). The skill level that will modify it is declared on line 16.

Line 41: Minutes needed to craft. Both static and dynamic values for crafting time can be modified by the world difficulty settings. For a static value change this line to: this.CraftMinutes = CreateCraftTimeValue(10f);. As it's written in the example, this item's craft time will be dynamic.

Line 49: This line assigns the recipe to a workbench. Do not assign to itself because then the first table could never be made. It's recommend to use a preexisting vanilla table.

Checkpoint #2

Check the functionality at this point -- it should be possible to see the recipe in the crafting table.

  1. Have the .unity3d and the .cs file in the /Eco Server/Mods/UserCode folder.
  2. Start the server and log in.
  3. Type /give Carpentry Table.
  4. Place the Carpentry Table down and interact to see the what can be crafted.
  5. Find the newly added recipe under the name Market Stall.
  6. Type /give Basic Upgrade 4.
  7. Put the basic upgrade into the table.
  8. Go back to the recipe for the Market Stall and make sure the Wood and the Cotton fabric inputs now require less, but the Hemp Mooring Rope still is the same.
    Note: In case the recipe hasn't changed close that table's window and interact with it again. It should for the recipes to refresh now that the upgrade is in it.

Create the World Object

Preparing the 3D Asset

  1. Open Blender.
  2. Load the 3D object created earlier for icon rendering -- Assets/WikiDemo/MedievalStall - Icon Scene.blend.
  3. Cleanup the scene...
    1. Delete any light source. Use the Scene Collection panel on the top-right side of the screen. These will have a 💡 icon and by default are named something like "sun", "point", "spot" or "area".
      Note: If your model is a light source or has one in it, you can leave that light source. The point here is to remove the ambient lights used for icon rendering.
    2. Delete any camera(s). Again, use the Scene Collection panel. These have a 🎥 icon and by default are named something like "camera".
  4. If there are multiple different 3D assets in the scene (like bags, crates, jars, ect.), join them all together...
    1. Select all of the meshes by holding Shift and clicking on each one in the Scene Collection panel (right side of window).
      Tip: Quickly select a group of them by selecting one near the top. Then hold Shift, Ctrl, and click on one near the bottom. This will both the one at the top and the one at the bottom, but also every item in between. Neat!
    2. Be in Layout workspace (top toolbar) and in the Object Mode...
      1. Find the drop down in the second toolbar from the top that has options like Object Mode, Edit Mode, Sculpt Mode, etc.
      2. Select Object Mode from that drop down.
    3. Find and open the Object menu (second toolbar down from the top).
    4. Select Join.
    5. In the Scene Collection panel, double click on the name of the newly joined mesh.
  5. Rename the joined mesh to MedievalStallMesh.
  6. Add and position a reference cube...
    1. Make sure the editor is in Layout view (top toolbar) and in the Object Mode...
      1. Find the drop down in the second toolbar from the top that has options like Object Mode, Edit Mode, Sculpt Mode, etc.
      2. Select Object Mode from that drop down.
    2. Then, add a reference cube. Open the Add menu (second top toolbar down).
    3. Hover Mesh.
    4. Select Cube.
    5. Open the View menu (second toolbar down).
    6. Select Sidebar.
    7. A new panel will have expanded.
    8. Along the right side of that panel there's buttons (Item, Tool, View, Animation). Find and click the Item button.
    9. Find and expand the Transform section
    10. Set the Location...
      1. X to 1.
      2. Y to 1.
      3. Z to 1.
    11. The bottom corner of the cube should be touching the where green and red axis lines meet.
  7. Move the reference cube's origin to (0, 0, 0)...
    1. Be in Layout workspace (top toolbar) and in the Object Mode...
      1. Find the drop down in the second toolbar from the top that has options like Object Mode, Edit Mode, Sculpt Mode, etc.
      2. Select Object Mode from that drop down.
    2. Open the View menu (second toolbar down).
    3. Select Sidebar.
    4. A new panel will have expanded.
    5. Along the right side of that panel there's buttons (Item, Tool, View, Animation). Find and click the View button.
    6. Find and expand the 3D Cursor section.
    7. Set the 3D cursor's Location...
      1. X to 0.
      2. Y to 0.
      3. Z to 0.
    8. Now in the Scene Collection panel, click on the Cube mesh to highlight and select it.
    9. Open the Object menu from the second toolbar down from the top.
    10. Hover Set Origin.
    11. Select Origin to 3D Cursor.
  8. Set the reference cube's dimensions...
    1. Be in Layout workspace (top toolbar) and in the Object Mode...
      1. Find the drop down in the second toolbar from the top that has options like Object Mode, Edit Mode, Sculpt Mode, etc.
      2. Select Object Mode from that drop down.
    2. Open the View menu (second toolbar down).
    3. Select and check the Sidebar option.
    4. The Sidebar menu just expanded over on the right side of the screen.
    5. To the right of the Sidebar, find and click the Item button.
    6. Expand the Transform section.
    7. Set the Dimensions...
      Note:
      These dimensions only make sense for the asset being used for this guide. If using a different one, set the dimensions to the size of the box that model should fit in.
      1. X to 4.
      2. Y to 3.
      3. Z to 3.
  9. Adjust the position and scale of the MedievalStallMesh to fit inside a box.
    1. Be in Layout workspace (top toolbar) and in the Object Mode...
      1. Find the drop down in the second toolbar from the top that has options like Object Mode, Edit Mode, Sculpt Mode, etc.
      2. Select Object Mode from that drop down.
    2. On the left side of the screen there's a column of icons. Hover over them to see their names.
    3. Select the Move tool.
    4. Click on the Medieval Stall to select it. Zoom out and reposition the camera so that the blue, green, and red arrows are visible.
      Tip: By holding the middle-mouse button and dragging the scene will rotate. By holding the middle-mouse button and the Shift key, the scene will pan.
      Tip: If panning or rotating the scene becomes slow or frustrating (especially after zooming), try selecting 3D asset from the Scene Collection panel, opening the View menu (second toolbar from top), and selecting Frame Selected. This will reset the view onto that object and controls should feel normal again.
    5. Click and hold one of the arrows. Move the mouse to drag the 3D asset towards the box.
    6. Move the 3D asset around till it's completely inside the box. If it cannot fit and is too big, continue to the next step.
      Tip: To select the 3D asset once it disappears, use the Scene Collection panel. Click on it there and the blue, green, and red arrows will show up again for it.
      Tip: There are preset views. To use them go to the View menu (second toolbar from top), hover Viewpoint, and select the view that would be most helpful.
    7. Find the Scale tool from the left side of the screen.
    8. Now the blue, green, and red "arrows" don't really look like arrows anymore. They are lines with boxes at the end.
    9. Click and hold on those lines to adjust the scale of the 3D asset to make it fit inside the box.
      Tip: There are little colored boxes in between the lines that can be dragged to scale the 3D asset more proportionally.
    10. Continue using the Move and Scale tools till the model fits. This will take patience and time.
      Tip: Hide the reference cube to see what is happening with the 3D asset. Go to the Scene Collections panel and click the 👁 button to hide it. Click that button again to show it.
  10. Move the reference cube's origin to (0.5, 0.5, 0.5)...
    1. Be in Layout workspace (top toolbar) and in the Object Mode...
      1. Find the drop down in the second toolbar from the top that has options like Object Mode, Edit Mode, Sculpt Mode, etc.
      2. Select Object Mode from that drop down.
    2. Open the View menu (second toolbar down).
    3. Select Sidebar.
    4. A new panel will have expanded.
    5. Along the right side of that panel there's buttons (Item, Tool, View, Animation). Find and click the View button.
    6. Find and expand the 3D Cursor section.
    7. Set the 3D cursor's Location...
      1. X to 0.5.
      2. Y to 0.5.
      3. Z to 0.5.
    8. Select the MedievalStallMesh using the Scene Collection panel.
    9. Open the Object menu (second toolbar down).
    10. Hover Set Origin.
    11. Select Origin to 3D Cursor.
  11. Select the reference cube named Cube from the Scene Collections panel.
  12. Open Object menu (second toolbar down).
  13. Select Delete.
  14. Move the MedievalStallMesh to (0, 0, 0)...
    1. Be in Layout workspace (top toolbar) and in the Object Mode...
      1. Find the drop down in the second toolbar from the top that has options like Object Mode, Edit Mode, Sculpt Mode, etc.
      2. Select Object Mode from that drop down.
    2. Open the View menu (second toolbar down).
    3. Select Sidebar.
    4. A new panel will have expanded.
    5. Along the right side of that panel there's buttons (Item, Tool, View, Animation). Find and click the Item button.
    6. Make sure the MedievalStallMesh is selected. Use the Scene Collection panel if needed.
    7. Find and expand the Transform section
    8. Set the Location...
      1. X to 0.
      2. Y to 0.
      3. Z to 0.
  15. Make sure the MedievalStallMesh is selected. Use the Scene Collection panel if needed.
  16. Open the Object menu.
  17. Hover Apply.
  18. Select All Transformations. Note: This step bakes all of the changes into the mesh. It's very important.
  19. Open the File menu from the top toolbar.
  20. Hover Export to open the sub-menu.
  21. Select FBX (.fbx)
  22. A Blender File View window will pop-up.
  23. On the right side of this window there's a ⚙️ icon. Click it to expand the settings region.
  24. In the expanded region find the Include section and expand it. Change the following:
    1. Find Object Types and only select Mesh. No other option should be highlighted for this setting.
  25. In the settings region scroll and find the Transform section and expand it. Change the following:
    1. Find Apply Scalings and set it to FBX All.
    2. Just below that find Forward and set it to Z Forward.
    3. Ensure that the next setting down, Up, changed to Y Up.
    4. Find Apply Unit and make sure it's checked.
    5. Next, find Use Space Transform check it.
    6. Lastly, find Apply Transform and check it too.
  26. Save it to Assets/WikiDemo/MedievalStall.fbx.
  27. Save the Blender scene...
    1. File drop down from top toolbar.
    2. Save As... to save the Blender scene to the computer.
    3. Save it to Assets/WikiDemo/MedievalStall - Eco Ready Scene.blend.

Add to Unity Scene

  1. Open Unity.
  2. Select the .fbx file in the project window.
  3. Open the Eco Tools menu from the top toolbar.
  4. Hover Mod Kit.
  5. Select World Object Setup.
  6. A World Object Setup window will pop-up.
  7. Make sure that Selected Objects reads MedievalStall.
  8. Also make sure that World Object Type is set to World Object.
  9. Press the Setup World Objects button.
  10. Notice in the project window that a new .prefab file was created -- MedievalStallObject.prefab
  11. Select the .prefab file in the project window.
  12. Select Objects from Hierarchy panel (left-side of the window).
  13. Find the Modkit Prefab Container (Script) component.
  14. Expand the Prefabs section in that component.
  15. Click the + button to add an item to the list.
  16. Either...
    1. Click the ⦿ button, switch to the Assets tab, find or search for MedievalStallObject, and double click on it. Make sure it's the medieval stall object with the .prefab ending.
    2. Drag the .prefab file onto the ⦿ button
  17. Open the File menu from top toolbar and select Save.
    Note: Do not skip. The scene must be saved for the ModKit build to work properly.
  18. Open the Eco Tools menu from the top toolbar.
  19. Hover Mod Kit.
  20. Select Build Current Bundle.
  21. Save the bundle to /Eco Server/Mods/UserCode/WikiDemo.unity3d

Scripting the World Object

WIP: Need occupancy code.

Code that links the Item to this World Object.

using Eco.Core.Items;
using Eco.Gameplay.Components;
using Eco.Gameplay.Items;
using Eco.Gameplay.Items.Recipes;
using Eco.Gameplay.Objects;
using Eco.Gameplay.Skills;
using Eco.Mods.TechTree;
using Eco.Shared.Localization;
using Eco.Shared.Serialization;
using System.Collections.Generic;
using System.Runtime.Versioning;
using System;

namespace WikiDemo
{
    #region Item
    [Serialized] // Tells the save/load system this object needs to be serialized.
    [LocDisplayName("Market Stall")] // Defines the localized name of the item.
    [Weight(100)] // Defines how heavy Arrow is.
    [Ecopedia("Work Stations", "Craft Tables", createAsSubPage: true)]
    [LocDescription("A medieval market stall.")] //The tooltip description for the item.
    public partial class MedievalStallItem : WorldObjectItem<MedievalStallObject> { }
    #endregion

    #region Recipe

    #region Object
    [Serialized]
    public partial class MedievalStallObject : WorldObject, IRepresentsItem
    {
        public Type RepresentedItemType => typeof(MedievalStallItem);
    }
    #endregion
}

Line 22: This changes from implementing Item to WorldObjectItem<MedievalStallObject>. This is what gives the item the ability to place the table down in the world.

Line 25: The "collapsed" Recipe section. See earlier sections in this guide to see what code belongs here.

Line 29: Declares the MedievalStallObject. It's important that this class name is matches exactly the .prefab file name because the name is what links them.

Line 31: This line is similar in function to line 22, it's declaring that this MedievalStallObject is MedievalStallItem when in inventories.

Checkpoint

Warning: In Eco v13.0.2, free-placed objects may display misaligned ghost cubes, even when configured correctly in your mod. This is a visual-only base-game bug—placement still works as expected, even if the object appears red near edges.

Export and see what it does. Ensure it's not lifting off the ground because of a non-curved shader.

Origin Point Editing

Talk about what it does: the point that the simulation considers this world object to be at.

Show how to move it around using blender.

Final Export

Export.

Package.

Distribute.