Skip to content
This repository was archived by the owner on Jan 14, 2023. It is now read-only.

ModTool Export Process

Dustin Lacewell edited this page Apr 17, 2019 · 1 revision

StartExport

  • Get the loaded scene's path
  • Ask user to save scene if they want to
  • Create new scen

Verify

  • Ensure serialization mode is Force Text
  • Ensure Editor version is same as ModTool was built with
  • Ensure Editor is not in play mode

VerifyAssemblies

First get all the assemblies to verify:

  • Get all assemblies in assets folder
  • Adds the ModTool.* and Mono.Cecil assemblies
  • Adds any assemblies mentioned in CodeSettings
  • Adds the mod assembly
  • Adds the Unity project's output assemblies like "Assembly-CSharp" and "Assembly-CSharp-firstpass.dll"

For each type in each module in each assembly:

  • check inheritance restrictions

For each field, property and method in each type:

  • check namespace restrictions
  • check type restrictions
  • check member restrictions
  • repeat for nested types

Verify Project

  • Make sure mod has a name
  • Make sure an output directory is set and exists
  • Make sure at least one platform is selected
  • Make sure at least one of scenes, prefabs, and scripts are chosen for export

Get Content

  • Find all prefabs and scriptables
  • Find all scenes
  • Find all monoscripts
  • Put them into ModContent instance

Create Backup

  • AssetDatabase.SaveAssets()
  • Delete the backup directory if it exists
  • Create the backup directory
  • Create a temporary assembly directory
  • Backup each asset, scene and monoscript from Assets/
  • Copy each assembly to the temporary assembly directory

Import Scripts

  • Abort if code isn't a selected export content type
  • Delete every script from the Assets/ folder
  • Remove spaces from prefix
  • Add version to prefix if specified in settings

Get Search Directories:

  • Add the Unity assembly paths
  • Add the assets path
  • Add the path of the netstandard assembly
Clone this wiki locally