Obenseuer/Modding:Game Decompilation: Difference between revisions

From Stalburg Wiki
Jump to navigation Jump to search
Nextej (talk | contribs)
mNo edit summary
Nextej (talk | contribs)
mNo edit summary
 
Line 79: Line 79:


Note that AssetStudio will not work for Unity 6, which is the next version of the game once the Bazaar update releases. You may then use the [https://github.com/Razviar/assetstudio/releases AssetStudio fork here] instead.
Note that AssetStudio will not work for Unity 6, which is the next version of the game once the Bazaar update releases. You may then use the [https://github.com/Razviar/assetstudio/releases AssetStudio fork here] instead.
[[Category:Community Content]]
[[Category:Obenseuer Modding]]

Latest revision as of 12:23, 13 September 2026

Notice on Copyright

Modding a game does not mean it is free of copyright. Redistributing assets is not allowed and is banned from distribution websites entirely. These instructions are here to allow you to browse the game's source without needing to request copyrighted assets.

Debugging

Calling UnityEngine.Debug.Log(Object) from a mod will print to the in-game console (F1 to access) as well as your Player.log file in your %Appdata%/../LocalLow/Loiste Interactive/Obenseuer/ directory.

The in-game console will format UnityEngine.Debug.Warn(Object) to be coloured yellow and UnityEngine.Debug.Error(Object) to be coloured red for better readability.

Please never submit bug reports to the official bug reporting GitHub page with a modded game instance. Disable or uninstall your modloader first and revert any manual file modifications (Steam game file verification will do this for you).

Reading Code

Obenseuer is a Unity game for Unity 2019.4.41f2 Mono. This makes it very simple to read source code for scripts as it is all in CIL.

To read code, you can either decompile the compiled assembly in its entirety using a tool such as:

Or you can read the decompiled output from an IDE while writing a mod after referencing the game's assembly, both JetBrains Rider and Microsoft Visual Studio provide this functionality.

Unity compiles 2 main assemblies which we care about (the rest are either third party libraries or default Unity assemblies which come with every game):

Reading Unity Documentation

If you need to reference a default Unity class, it is recommended to read the official Unity documentation at https://docs.unity3d.com/2019.4/Documentation/ScriptReference/index.html.

Browsing Scene Hierarchy In-Game

One of the ways you can browse scene hierarchy in-game is to use a runtime editor. There are two major options:

Browsing Scene Hierarchy in Unity Editor

The other way to browse scene hierarchy (as well as the rest of the project) is to decompile the full game back into a Unity project.

Note that these instructions are somewhat unreliable, given each distribution of the game may change how the decompiler generates the project even slightly, which means some extra work may be required to get the project into a workable state even if you do follow them perfectly. This is especially true for code errors, you may have to comment out or fix some code errors which the decompiler wrongly generated.

The tool to do this with is AssetRipper. Following the steps below will allow you to obtain a decompiled version of the game.

  1. Drag the game's folder into AssetRipper using the default settings.
  2. Delete AuxiliaryFiles in the generated folder.
  3. Bring the contents of the ExportedProjects folder up one level, then delete the directory.
  4. Delete LightingDataAssets in the Assets folder. This will prevent crashes when opening it in the editor.
  5. Create a Assets/Plugins/ directory.
  6. Drag the following assemblies from the compiled game's directory to the Assets/Plugins/ directory:
    1. Assembly-CSharp-firstpass
    2. AstarPathfindingProject
    3. BehaviourDesignerRuntime
    4. Pathfinding.ClipperLib
    5. Pahtfinding.Ionic.Zip.Reduced
    6. Pathfinding.Poly2Tri
    7. SALSA-LipSync
  7. Install Unity 2019.4.41f2.
  8. Open the project using Unity.
  9. Change the .NET compatibility level in the project settings to 4.x. To access the project settings menu, go to Edit > Project Settings > Player > Other Settings > Configuration > Api Compatibility Level
  10. Install Packages from the Package Manager (to access Package Manager, go to: Window > Package Manager):
    1. TMPro
    2. Post Processing
    3. Mathematics
    4. Addressables
    5. Multiplayer HLAPI
    6. Entities (this is a preview package in 2019.4.41f2, you need to install it from that tab)
    7. Animation Rigging (this is a preview package in 2019.4.41f2, you need to install it from that tab)
  11. Fix any code errors

Browsing and Exporting Singular Assets

You may simply want to export a singular asset or a small number of assets without caring about project structure. In this case, AssetStudio is a tool which allows you to do that with little effort and no time, unlike decompiling the full game which may take several hours.

In this case, you can use AssetStudio.

Note that AssetStudio will not work for Unity 6, which is the next version of the game once the Bazaar update releases. You may then use the AssetStudio fork here instead.