The following tutorial is copied from this github example project.
The github page contains gifs for each step, they could not be added since forum posts are limited to a maximum of 3 images (for some reason)
Getting Unity
First, you need the correct version of the Unity Editor. This is version 5.4.0f3, creating blocks may work with other versions, but this is untested. We use this version because that is the version TerraTech is build with. Unity download page
Setting up the project
Album of gifs for each step
Setting up the scene
In order to add a model to your block, the model should already be imported into the Unity Editor.
BlockPacks are put in the /GeneratedAssetBundles folder of the Unity project. To install these, put them in TerraTech/Nuterra_Data/BlockPacks/
You can use the following script to make copying the required files easier:
/GeneratedAssetBundles/copy-to-nuterra.bat
The github page contains gifs for each step, they could not be added since forum posts are limited to a maximum of 3 images (for some reason)
Getting Unity
First, you need the correct version of the Unity Editor. This is version 5.4.0f3, creating blocks may work with other versions, but this is untested. We use this version because that is the version TerraTech is build with. Unity download page
Setting up the project
- Download or clone the repository onto your computer.
- Open the project with Unity 5.4.0f3.
- Click Nuterra > Build AssetBundles to verify the assetbundles can be succesfully build.
Album of gifs for each step
Setting up the scene
- Add a cube to the scene (3D Object > Cube).
- Set the position of the cube to (0, -1, 0)
- Add an empty GameObject to the scene (this will be referred to as your root object).
- Set the position of the root object to (0, 0, 0)
In order to add a model to your block, the model should already be imported into the Unity Editor.
- Drag the model onto the root object, so it will be put inside of it.
- Change the scale, position and rotation of the model to be correct for the block
- Add colliders (note: if you want to use mesh colliders, they must be convex!)
- Add the following script to the root object: Scripts > Nuterra.Editor > Custom Block Prefab
- Setup the information to your liking.
- Make sure the BlockID is unique, otherwise Nuterra will throw an error during startup.
- Make sure the dimensions of your block are at least 1 in each direction.
- Create a folder for your blockpack, it must exist under /Blocks, example: /Blocks/MyFirstPack
- Set the asset bundle of your blockpack folder with a name, it is handy to put all your assets in this folder so they all get serialized
- Drag the root object into your blockpack folder to save the prefab To save future edits on your custom block, you need to use the Apply button on the root object.
BlockPacks are put in the /GeneratedAssetBundles folder of the Unity project. To install these, put them in TerraTech/Nuterra_Data/BlockPacks/
You can use the following script to make copying the required files easier:
/GeneratedAssetBundles/copy-to-nuterra.bat
@Echo off
set TT_ROOT=D:\Program Files (x86)\Steam\steamapps\common\TerraTech Beta
set PACK_NAME=myfirstpack
set TT_BLOCKS=%TT_ROOT%\Nuterra_Data\BlockPacks
if not exist "%TT_BLOCKS%" mkdir "%TT_BLOCKS%"
copy /Y %PACK_NAME% "%TT_BLOCKS%\%PACK_NAME%"
copy /Y %PACK_NAME%.manifest "%TT_BLOCKS%\%PACK_NAME%.manifest"
pause
set TT_ROOT=D:\Program Files (x86)\Steam\steamapps\common\TerraTech Beta
set PACK_NAME=myfirstpack
set TT_BLOCKS=%TT_ROOT%\Nuterra_Data\BlockPacks
if not exist "%TT_BLOCKS%" mkdir "%TT_BLOCKS%"
copy /Y %PACK_NAME% "%TT_BLOCKS%\%PACK_NAME%"
copy /Y %PACK_NAME%.manifest "%TT_BLOCKS%\%PACK_NAME%.manifest"
pause