Skip to content

An example how to add a custom model with your mesh and animations

License

Notifications You must be signed in to change notification settings

hanshandong2024/DSP-Mods

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSP Mods

Repo with source code for my mods. Also contains a mini guide on custom machine meshes and animations

Check Registry Tool out. It is useful to quickly create new items, recipes, techs, etc.

In the Unity folder you can find needed scripts to create your own buildings.

  • ExportAssetBundles script is used to force unity to build asset bundles.
  • BetterMeshDataAsset makes sure that if you open MeshDataAsset in inspector nothing will break(Also is used to bake mesh data from Mesh object).
  • AnimationBakerWindow is the baker.
  • EditorObjExporter can export unity meshes to obj file(Optional)
  • FixPrefabMeshes can POTENTIALLY(Always have a backup, just in case) fix some prefabs to be useful for baking animations. You will need to have all meshes used in game with their names intact imported in your project. Also you might need to fix prefab a bit after that. Unfortunately, it VERY likely will crash unity, so make sure to save everything before that happens.(Optional)

Steps on making this all work

  1. Create unity project and either put Assembly-CSharp to reference in scripts or use ThunderKit to automate that.
  2. Extract or create needed assets(Models, animations, prefabs, etc)
  3. Fix extracted prefab so that there is no missing scripts and all meshes and materials(Although i'm still unable to compile ingame's shaders) are there
  4. If you intent to use prefab ingame you also need to properly setup all needed description scripts(Like BuildConditionConfig, SlotConfig, etc). Game uses these scripts to figure out what is what and where. If you are unsure how to set them up, try using RuntimeUnityEditor and LDBTool's utility to explore Proto definitions.
  5. Make sure that animation clip works, by dragging fixed prefab into preview window(It should animate it)
  6. Open baker (Window->DSP Tools->Verta Animation Baker) and select prefabs root, enter name and hit bake. You will get MeshDataAsset and .verta file. Both are needed to make this work
  7. Make sure you correctly define names and references to two created files in LODModelDesc script
  8. Create new Aseet Bundle and add all needed assets to it(You cannot add .verta file, becuse it won't let you). Then build Asset Bundle (Window->DSP Tools->Build AssetBundle)
  9. Write code and import everything in.

Project view: Project view

Installation of example mod

  1. Download and unpack BepInEx into game root directory
  2. Download and install LDBTool
  3. Download and install DSP_CustomBuildings

About

An example how to add a custom model with your mesh and animations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%