Repository navigation
Testing and Errors
Sooner or later something will not work the way you expected, and the first
place to look is the log. Your mod writes its own lines there through its
Logger, and Bunny Loader writes there every error it finds while loading and
running mods. This page shows where to read the log, how to try a new version
of your mod, and what the most common messages mean.
The quickest place is inside the game: the in-game editor, which you open from the Mod Menu, shows the mods' lines as they are written. When a mod fails, Bunny Loader also opens an error panel on the screen with the message, unless the player turned that off in the launcher's Settings (Show errors in game).
The whole session is also saved to a file, one per game session, in
Android/data/com.bunnyloader.beta/logs/ on the phone (without .beta for
the non-beta app). In the launcher, Settings → Diagnostics shows a report
of the last session with the mods' lines and a button to copy it, which is the
easiest way to paste it on Discord. With the phone connected to a PC, adb logcat -s BunnyLoader shows the same lines live.
A line from your mod looks like this:
16:52:04.340 I [mod] [FirstMod] First Mod: active
To write one, use the mod's Logger, which is tModLoader's ILog: Info,
Debug, Warn, Error and Fatal, the ...Format variants, and an
exception as an optional second argument. Error and Fatal also open the
error panel. In the mod class it is just Logger; in a content class, such as
a ModItem, it is Mod.Logger; anywhere else,
ModContent.GetInstance<FirstMod>().Logger.
public override void SetStaticDefaults()
{
Mod.Logger.Info($"{Name} is item {Type}");
}The game loads your mod once, when it starts. Bunny Loader starts the .NET
runtime, loads your code, creates your mod class and calls its Load(), and
then sets up every item, NPC and other content class it found. All of that
happens before any world exists, on a background thread, so Load() is the
place to install hooks but not to read Main.player: there is no player yet.
Because of that, a new version of your mod only takes effect when the game starts again: .NET cannot unload code from a running game. Test in BL Editor restarts the game for you. On a PC, after importing the new package, use the Restart button in the Mod Menu, or close the game and press Play again.
Everything below shows up in the log and in the error panel.
| The log says | What it means | What to do |
|---|---|---|
mod <uid>: no class extends Terraria.ModLoader.Mod |
The .dll has no : Mod class. |
Add one (using Terraria.ModLoader;). |
mod <uid>: X.cs did not compile (N error(s)) |
A mod with sources has errors (listed just above, with file and line). | Fix them; the next load compiles again. |
mod <uid>: compiling X.cs (the sources changed) |
Not an error: the stamp in bin/ did not match, so the phone compiled. |
Publish through the catalog so players get it compiled. |
mod <uid>: the .NET runtime did not start |
The APK has no C# runtime. | Update Bunny Loader. |
FileNotFoundException: Could not load file or assembly 'X' |
Your mod uses a library the phone does not have. | A library of your own (a NuGet package): put its .dll next to yours, in the mod folder. A System.* one outside the list: not available yet. |
game class Terraria.X not found |
A type that does not exist in this game version. | Check the name in the game's dump. |
MissingMethodException: Terraria.Item: 'void Foo(int x)' not found |
The method changed or does not exist in this game version. | Update BunnyLoader.dll and rebuild. |
struct layout ... differs from the game |
Your BunnyLoader.dll was made for another game version. |
Use the .dll from the APK you have installed. |
NullReferenceException |
You used a game object that is null (often new Item(), see guide 4). |
Check IsNull before using it. |
Bunny Loader wiki ·
Discord ·
Repository ·
BL Editor
Written for Bunny Loader 0.5.5-beta and Terraria Mobile 1.4.5.8.6.
Bunny Loader is not affiliated with Re-Logic or 505 Games.
