Valheim Unity Project Guide - Valheim-Modding/Wiki GitHub Wiki

ℹ️ Note

This is NOT a guide for modding. It is a guide for getting started on custom asset creation for Valheim.

Carefully read the guide and follow every step in the same order as written in this guide.

Prerequisites

Download/install the following:

  1. Git
    • Choose the version for your machine. Here is a quick-link to the windows download Install Git on Windows
    • Once Git is installed, reboot your machine and continue through this guide! Rebooting might not be needed in some cases, but it's advised to do so.
  2. AssetRipper
    • Extract it somewhere for later. Downloading a version above 1.0.12 seems to corrupt meshes but need more investigation.
  3. Unity Hub
    • Click on Download Unity Hub and install it.
  4. Unity 2022.3.50f1
    • Click on the link in Install this version with Unity Hub..
    • When installing Unity, you can uncheck all optional modules.

Step 1: Rip Assets

  1. Run AssetRipper by launching the AssetRipper.GUI.Free.exe. It will open up a console window as well as a page in your browser. Click File -> Settings

Settings

  1. Use these settings.

Settings

  1. Go to FileOpen Folder. Find your Valheim directory and select the top level "Valheim" folder. (You can also drag the folder into AssetRipper).

Settings

  • If this error shows up you can ignore it. Ignore
  1. Once loaded, go to ExportExport all Files and select a new empty directory (i.e. ValheimRIP).

Settings

  1. Once loaded click Select Folder and then Export and let it complete.

Settings

  1. You will now have two folders inside your exported folder called AuxiliaryFiles and ExportedProject. Delete AuxileryFiles and rename ExportedProject to something like ValheimRIP and move it to it's permanent location.

  2. Find the manifest.json in Packages located in the folder you exported to and add these values. In case your manifest.json got corrupted you can copy-paste it from HERE

    "com.unity.inputsystem": "1.10.0",
    "com.unity.textmeshpro": "3.2.0-pre.5"
    

manifest.json

  1. Delete these files + their META files in Assets/Plugins. It is very important you do this before opening your project.

    Unity.InputSystem.dll, 
    Unity.InputSystem.ForUI.dll
    Unity.TextMeshPro.dll
    
  2. Restoring shaders.

    1. Download Yaml shaders.
    2. Copy the content of the zip into Assets/Shader and overwrite.

Step 2: Open in Unity

  1. Run Unity Hub.

  2. Click on Open (or Add in new versions).

    2022-07-26 00_44_02-Unity Hub 3 2 0
  3. Find the folder where you moved ValheimRIP to.

  4. Select ValheimRIP folder and click Open. This will take up to 20-30 mins.

  5. If the API Update Required message box appears, click I Made a Backup. Go Ahead!. (This only occur when picking Decompiled.)

    2022-08-04 02_09_59-API Update Required

    If the Do you want to enable the backends? appears, click Yes.

    2022-08-04 02_09_59-API Update Required
  6. Wait for the project to fully load (this can take up to 30 mins).

    1. Go to Edit -> Project Settings -> Graphics and change Custom Shaders to Built-in Shader.
    2. Open wood_portal to confirm that effects/particles looks good by playing them.
  7. Perform a script recovery if needed (This shouldn't happen if you did step 8 in previous section).

    1. Install NG Script Recovery via Package Manager from the Unity Asset Store
    2. Open NG Script Recovery from the inspector where the missing script is, or from the menu Window -> NG Tools -> NG Missing Script Recovery
    3. In the Project tab select "Prefab", "Asset", "GameObject in Scenes"and "Scenes". Hit the Scan button.
    4. Hit "Start Recovery" to perform an automatic recovery.
    5. You may see a pop-up asking you to import TMP Essentials. Click "Import TMP Essentials" and close the pop-up.
    6. Finish the script recovery by manually picking the best match for any remaining broken object until the process is finished.
  8. Click Window and then open AssetBundleBrowser, click the first bundle and then ctrl+A to select all, now delete and wait for it to finish. Depending on your system it might take a little bit and then it will do another import session like when you first opened the rip.

  9. You should now have a good rip you can work on. There will still be a few missing materials, scripts in scenes. These are not urgent to fix but you can if you want. For convenience you can put all missing materials to Standard. For fonts you can use any of the TMP ones. This step is only useful if you care about exploring scenes with working shaders, text and if you don't you can ignore this. It's possible to fully restore scenes and correct any shaders to match vanilla. That's however outside of the scope of this guide and you can join any modding Discord for help with that.

  10. [Optional] Create a copy of your ValheimRIP folder in the same directory. Rename the copy to something like ValheimRIPCustom. Your ValheimRIP folder will be used as a clean version of the ripped game assets and the ValheimRIPCustom version is where you will duplicate, create new, or edit existing assets.

  11. [Optional] Create another copy of your ValheimRIP and call it ValheimTemplate and then delete the content of the Asset folder. You can then copy-paste this project for each mod you want to make. You then use ValheimCustom to export assets into your new clean project. This is beneficial as you only export what you need and not accidentally bring in the whole game from automatic references.

If you need further help you can join any of the modding Discords linked here.

🥳 That's it. Happy modding! Keep reading for more information.

Notes about Shaders

  • Dummy shaders are editable and can be used with Shader Replacer but effects/particles looks broken in Unity.

  • Yaml shaders are not editable but effects/particles looks correct in Unity (you will need to recover them first).

What do I pick?

  • Pick Dummy if you want to use Valheims shaders with Shader Replacer and you do not care about effects/particles that looks broken (white/pink squares or other artifact looking graphics)

  • Pick Yaml if you want to have effects/particles that look correct and that you can use as reference when replacing them with standard, legacy, custom.

Notes on Setting up Graphics APIs

If you are creating assets for the game you will want to make sure your build is compatible with Vulkan and OpenGL graphics. If you do not do this for your project then some items in the game will show up incorrectly, typically untextured bright pink/magenta, for some players and there will be related errors in Player.log.

  1. Open your unity development project.
  2. Go to Edit -> Project Settings.
  3. In the Player tab find the "Other settings".
    1. Uncheck "Auto Graphics API for Windows".
    2. Under "Graphics APIs for Windows" make sure both "Direct3D11" and "Vulkan" are added.
    3. Uncheck "Auto Graphics API for Linux".
    4. Under "Graphics APIs for Linux" make sure both "OpenGLCore" and "Vulkan" are added.

Error message example, showing missing OpenGL support:

Desired shader compiler platform 15 is not available in shader blob
ERROR: Shader Unlit/Color shader is not supported on this GPU (none of subshaders/fallbacks are suitable)

Notes on Current Issues

Common Errors

These common error logs can be ignored for now.

Destroy may not be called from edit mode! Use DestroyImmediate instead.
Destroying an object in edit mode destroys it permanently.

Assertion failed on expression: 'CurrentThreadIsMainThread()'

Common Issues

  • Mouse does not get locked to the playtest window.
  • Some UI elements like the stamina bar don't disappear or will flash.

Game Versions 0.214.3 - 0.217.25

Use these versions when ripping the older game version:

  • AssetRipper 0.3.0.0
    • This version is a December pre-release, not the latest version.
    • Under Assets, download AssetRipperGUI_Your Operating System.zip.
    • Extract it somewhere for later.
  • ValheimExportHelper 1.5.0
    • Under Assets, download ValheimExportHelper.zip.
    • Extract all (4) files to the AssetRipper/Plugins directory (create a Plugins folder if it is missing).
  • Unity 2020.3.45
    • Click on the link in Install this version with Unity Hub..
    • When installing Unity, you can uncheck all optional modules.

Old Guides 2022

Installing Asset Bundle Browser

The purpose of the Unity Asset Bundle Browser tool is to export your modded prefabs into a standalone asset bundle.

  1. Go to WindowPackage Manager.
    2022-07-28 00_04_28-
  2. Click on the ➕▼ button and choose Add package from git URL.
    2022-07-28 00_04_56-Package Manager
  3. Paste https://github.com/Unity-Technologies/AssetBundles-Browser.git and click Add.
    2022-07-28 00_05_15-Package Manager

Unity Project for Valheim Asset Development

ℹ️ Note

This is a minimalistic tutorial for achieving asset creation in Valheim. It will not allow scene browsing or play testing.

If you want more, follow the advanced tutorial.

Step 1: Rip Assets

  1. Run AssetRipper.

  2. Set Script Export Format to Dll Export Without Renaming.
    2022-07-26 08_01_33-Asset Ripper GUI

  3. Go to FileOpen Folder and find your Valheim directory.
    2022-07-21 19_15_02-Asset Ripper GUI

  4. Once loaded, go to ExportExport all Files and select a new empty directory (i.e. valheim_unity).
    2022-07-21 19_16_21-Asset Ripper GUI

  5. Wait for it to finish.

Step 2: Open in Unity

  1. Run Unity Hub.

  2. Click on Open.
    2022-07-26 00_44_02-Unity Hub 3 2 0

  3. Find and select valheim_unity/valheim/ExportedProject and click Open.

  4. If the API Update Required message box appears, click I Made a Backup. Go Ahead!.

  5. If the Enter Safe Mode? message box appears... (click for more) 2022-07-26 01_45_50-Enter Safe Mode_
    1. Click Enter Safe Mode.

    2. If you see two error messages involving Library\PackageCache\com.unity.collab-proxy...
      2022-07-26 01_53_20-ExportedProject - SAFE MODE - 2020 3 33f1 _DX11_

      1. Go to WindowPackage Manager.
        2022-07-26 15_43_48-ExportedProject - SAFE MODE - 2020 3 30f1 _DX11_

      2. Click on the Packages dropdown and choose In Project.
        2022-07-26 01_57_39-Package Manager

      3. Select Version Control from the list and click Remove.
        2022-07-26 08_10_04-Package Manager

    3. If you have other problems, consult the Discord.

  6. Wait until the project is fully loaded.

Step 3: Compatibility Fixes

These changes are to fix compatibility issues with exported assets in Valheim.

  1. Click EditProject Settings...
    2022-07-26 01_54_39-

    1. Under PlayerOther SettingsRendering...
      1. Uncheck Auto Graphics API for Windows
      2. Uncheck Auto Graphics API for Linux
      3. Click the under Graphics APIs for Windows and choose Vulkan to add it to the list.
        2022-07-26 21_58_48-AssetBundle - SampleScene - PC, Mac   Linux Standalone - Unity 2020 3 33f1 Perso
        2022-07-26 21_47_01-Project Settings
    2. Under GraphicsBuilt-in Shader Settings, change the Deferred option from Custom shader to Built-in shader.
      2022-07-26 08_17_30-Project Settings

(Advanced) Ripping Assets for Valheim Data Mining and Scene Viewing

⚠️ Warning

This tutorial is for advanced users. It may also quickly become outdated.

Step 1: Rip Assets with Source Code

Follow Step 1: Rip Assets from the base tutorial with the following changes:

  • Do NOT change Script Export Format or any other options. Leave it as Decompiled (the default).

Step 2: Resolving Source Code Issues

Make the following changes to the source files in your valheim/ExportedProject/Assets/MonoScript directory created by the previous step. These can be done easily by opening the directory in a powerful editor (i.e. Visual Studio Code or similar).

  1. Replace all of the following occurrences in all project files (Replace in Files):
    1. StructLayout(0StructLayout(LayoutKind.Sequential
    2. StructLayout(2StructLayout(LayoutKind.Explicit
  2. In assembly_steamworks/Steamworks/Callback.cs, delete the entire block in private event DispatchDelegate m_Func { ... }, replace it with private event DispatchDelegate m_Func;.
  3. In assembly_steamworks/Steamworks/CallResult.cs, delete the entire block in private event APIDispatchDelegate m_Func { ... }, replace it with private event APIDispatchDelegate m_Func;.
  4. In assembly_utils/Utils.cs, replace CompressionLevel.Fastest with System.IO.Compression.CompressionLevel.Fastest.
  5. In assembly_valheim/Heightmap.cs delete [ExecuteInEditMode].

Step 3: Continue the Base Tutorial

Continue the base tutorial as normal from Step 2: Open in Unity.

Other Tutorials

Youtube

Valheim Modding - Ripping the game (Unity Project)

⚠️ **GitHub.com Fallback** ⚠️