Localizing Strings in Daggerfall Unity – Part 5

Localizing Strings in Daggerfall Unity – Part 1
Localizing Strings in Daggerfall Unity – Part 2
Localizing Strings in Daggerfall Unity – Part 3
Localizing Strings in Daggerfall Unity – Part 4
Localizing Strings in Daggerfall Unity – Part 5
Localizing Strings in Daggerfall Unity – Part 6

Information in this series is now out of date. Localizing strings in Daggerfall Unity is now possible using simple font and text files only. It is no longer necessary to use Unity Editor or write any code. A new tutorial series will be posted towards the conclusion of 0.14.x release cycle. This information is left in place for reference only.

Create Mod Settings

We’ve now created new locales, string tables, imported text, translated text, and seen how to manually enable translated text in-game. We’ve also worked through concepts unique to Daggerfall Unity like character remapping, macros, and RSC markup. The next step is to create our mod settings.

  1. Click Daggerfall Tools menu > Mod Builder
  2. Click Create New Mod
  3. Navigate to path Assets/Game/Mods/DemoTranslationMod
  4. Set Filename to DemoTranslationMod
  5. Click Save
  6. Fill out some information about your mod, such as mod name, version, creator name and contact, etc.
  7. Select the platforms you want to build for. We’re just building for Windows in this tutorial.
  8. Click Save Mod Settings to File to save our settings. This should be done any time the settings are changed in Mod Builder.

You should now have something like below (click for full size).

Click Save Mod Settings to File and close the Mod Builder window.

Verify Mod Found

After completing Part 4, you should have the DaggerfallUnityStartup scene open. If not, please open this scene now from Assets/Scenes.

Daggerfall Unity will load any mod settings found as a virtual mod when starting from launcher scene. We’re going to check our new mod settings are found.

  1. Click editor Play button to start game
  2. Click Mods button in launcher
  3. Verify that Demo Translation Mod is listed under Mods Found and it is Enabled

Click editor Play button again to stop game.

Note: If you forget to stop Play from editor, your future changes will not be saved. Unity will revert editor changes when Play is stopped.

Create Mod Script

We’re now going to create a small C# script for our mod to coordinate everything at startup. To begin with, this script will simply set the translated text tables to Live String Tables, as we did manually in Part 3.

  1. In Project view, navigate to Assets/Game/Mods/DemoTranslationMod/Assets
  2. Right-click in empty space space inside this folder and click Create menu > Folder to create a new folder
  3. Name this folder Scripts

Now we can create our C# script.

  1. Navigate into Scripts folder above
  2. Right-click in empty space inside this folder and click Create menu > C# Script to create a new C# script
  3. Name this script StartupScript (Unity will automatically save with .cs extension)

Double-click StartupScript to open it in your configured code editor. Replace the full contents with below and save changes.

using UnityEngine;
using DaggerfallWorkshop.Game;
using DaggerfallWorkshop.Game.Utility.ModSupport;

namespace DemoTranslationMod
    public class StartupScript : MonoBehaviour
        // Define the names of translated string table collections
        const string runtimeInternalStrings = "Demo_Strings";
        const string runtimeRSCStrings = "Demo_RSC";

        public static Mod mod;

        [Invoke(StateManager.StateTypes.Start, 0)]
        public static void Init(InitParams initParams)
            mod = initParams.Mod;
            var go = new GameObject(mod.Title);

        private void Awake()
            // Set TextManager properties to use translated string table collections
            TextManager.Instance.RuntimeInternalStrings = runtimeInternalStrings;
            TextManager.Instance.RuntimeRSCStrings = runtimeRSCStrings;

            Debug.Log("StartScript has completed.");

Add Script To Mod

Now we have a script to set our string tables at start, we need to add this script to our mod’s list of assets.

  1. Click Daggerfall Tools menu > Mod Builder
  2. Select StartupScript in Project view
  3. Click Add Selected Assets in Mod Builder
  4. Expand Files in Mod Builder (click the little arrow next to Files to expand/contract)
  5. Confirm that StartupScript has been added to list of assets included in mod
  6. Click Save Mod Settings to File and close Mod Builder.

Now start the game with Play in Unity Editor. Click Play again on the launcher screen to start game as normal.

As the main game starts, you should see the following output to Console view. It will be near the end of output, but you might have to scroll up a little. The highlighted line below was emitted by our mod script, so we know it ran the Init() method.

If you don’t see the above, check that StartupScript is added to Mod Builder and you clicked Save Mod Settings to save changes. Be careful not to make editor changes while the game is playing.

Now script has executed, click on TextManager in Hierarchy view while game is running and confirm script has set correct names to Live String Tables in Inspector view. This live change by our script will only persist until game closes.

Now test translated strings are being used. We’ll test this by starting a new character as we did in Part 3.

  1. Select French (fr) locale from selector at top-right of Game view.
  2. Click Start New Game
  3. Confirm French language is shown

Click Play in editor to stop the game.

We now have a Daggerfall Unity mod including translated string tables and a C# script to coordinate settings. We will continue to build on this in Localizing Strings in Daggerfall Unity – Part 6.

Posted in Daggerfall Unity, Technical Content, Tutorials.