How does the tool work - ParkitectNexus/ParkitectNexusClient GitHub Wiki


The tool

ModSpark is a unity plugin that adds a couple of editor windows.

If you open the Mod-Setup window, there will be a GameObject added to the scene called "ParkitectModManager", and on this manager there is a component that saves all the data from the current mod. So you are able to create in each scene one mod.

Exporting

It's useful to know how exporting works to understand what you are doing and what you are publishing. These are the steps the tool takes while exporting your mod:


1. Creating Prefabs

The tool will create temporarily Prefabs(Preconfigured GameObjects) for all the object that are in the mod. So if you edit your object in the scene it will be saved.


2. Creating Assetbundle

The tool will get all the prefabs and store them in a AssetBundle (This is some kind off a package with all the models/objects). The AssetBundle will be created at: Assets/Mods/[Mod Name]/assetbundle/mod.


3. Creating XML file

The tool will generate a .xml file, in this file you will find all the values that are set with the tool it should look like this:

The XML file will be created at: Assets/Mods/[Mod Name]/[Mod Name].xml.


4. Creating JSON files

The tool will also create two json files, objects.json & mod.json.

In objects.json you will find all the GameObject names. This file is used by parkitect Nexus to look if there are object's from your mod in a blueprint or save game.

In mod.json you will find the settings for your mod used by the Parkitect Nexus Client. The JSON files will be created at: Assets/Mods/[Mod Name]/.


5. Copy to pnmods

The tool will ask if you wnat to copy your mod to Documents/Parkitect/pnmods/, it will automatically Un-Zip the Template for the mod.


Loading Mods

If you let the tool copy the mod to Documents/Parkitect/pnmods/, there will be a template with it. This template/ModLoader will read the xml file, based on the OBJName in the xml file, it will try to Instantiate (Spawn it from the assetbundle into the scene). Then the template/ModLoader will read all the properties and send those to the Depender. The Depender will read the properties that he recieved from the template/ModLoader. Now the Depender will try to mod the objects into the game. So when there is a Parkitect Update, that change the way Deco object are imported into the game, only the Depender have to Update to make all the mods work again.