-
Notifications
You must be signed in to change notification settings - Fork 3
Asset Mod
First you need to create your assets.
Here is the step to create an AssetMod:
-
Read the C:S 2 wiki on how to set up the Modding Toolchain.
-
Once you have the modding toolchain ready, you can open Visual Studio 2022 and create a new project.
Image

-
Search the
Cities: Skylines IImod template, select it and click onNext.Image

-
Setup your project.
Image

-
Setup more your project, you can already edit the desciption of your mod, you can also edit it later.
Image

-
Now you need to add ExtraAssetImporter as dependency to your project.
For That you need to double click on the project name (see image under), if you don't have this panel press
Ctrl + Alt + L.Image

Once you double click on it you should see that pop (see the image)
Image

Add this code :
<ItemGroup> <Reference Include="$(UserDataPath)\.cache\Mods\pdx_mods\80529_*\ExtraAssetsImporter.dll" Private="False" /> </ItemGroup>
And the file should look like this and you should see the ExtraAssetsImporter in your dependency.
Image

-
Since wa are in this file we are going to add the code needed to send your assets to PDX mod.
For that you need copy/past this code in the file
<Target Name="GetCustomAssetsFiles" AfterTargets="DeployWIP"> <ItemGroup> <AdditionalFilesToDeploy Include="CustomAssets\**\*.*" /> </ItemGroup> <Copy SourceFiles="@(AdditionalFilesToDeploy)" DestinationFiles="@(AdditionalFilesToDeploy->'$(DeployDir)\%(RecursiveDir)%(Filename)%(Extension)')" /> </Target>
and it should now look like this.

-
Now that you have ExtraAssetsImporter as dependency we can create create the asset mod.
For that double click on the Mod.cs file and start by deleting all the content in the
OnLoadand in theOnDisposefunction, also deletepublic static ILog Logline (there is an image under).Now add this line before the OnLoad method (there is an image under).
private string pathToModFolder;
Next add these lines in the OnLoad method (there is an image under).
if (!GameManager.instance.modManager.TryGetExecutableAsset(this, out var asset)) return; pathToModFolder = $"{new FileInfo(asset.path).DirectoryName}"; ExtraAssetsImporter.EAI.LoadCustomAssets(pathToModFolder);
And alos add this line in the OnDispose method (there is an image under).
ExtraAssetsImporter.EAI.UnLoadCustomAssets(pathToModFolder);
The content of the file should look like this at the end.

-
Now let's add the custom assets to the mod. For that you need to create your
CustomAssetsfolder in the project folder and then move all the custom assets folder (CustomSurfaces,CustomDecals) in thisCustomAssetsfolder.Like this

-
Let's Build our mod now. To do that right click on the project file
To do that right click on the project file and click on Build.

-
You can start the game and place your custom assets.
-
To publish your assets mod read the important information on the game wiki and follow the step on the C:S 2 wiki and for the Dependency ID put this one
80529.
If you need help, join one or the two discord mentioned in the Community