NeighTools / UnityDoorstop

Doorstop -- run C# before Unity does!
GNU Lesser General Public License v2.1
419 stars 62 forks source link

[question] Using self-compiled v4 Doorstop #51

Closed zachshattuck closed 2 months ago

zachshattuck commented 2 months ago

Hey all, apologies for the noob question.

I'm trying to inject some basic code into the Unity game SkaterXL.

When I build the Doorstop project, I get build/windows/x86/release/doorstop.dll file. I renamed this file to winhttp.dll and copied it into the same directory as the game's executable, along with a doorstop_config.ini that looks like so:

# General options for Unity Doorstop
[General]
# Enable Doorstop?
enabled=true
# Path to the assembly to load and execute
# NOTE: The entrypoint must be of format `static void Doorstop.Entrypoint.Start()`
target_assembly=TestMod1.dll
# If true, Unity's output log is redirected to <current folder>\output_log.txt
redirect_output_log=false

TestMod1.dll is a compiled .NET 4.0 Project that contains the following code:

using System.IO;

namespace Doorstop
{
    class Entrypoint
    {
        public static void Start()
        {
            File.WriteAllText("doorstop_hello.log", "Hello from Unity!");
        }
    }
}

However, when I run SkaterXL.exe, I never get an outputted doorstop_hello.log file.

Is there anything apparent that's wrong about my setup here? I'm not positive where I'm going wrong. Any help would be appreciated. Thanks!

zachshattuck commented 2 months ago

Sorry all, I figured it out. Turns out I had to use build/windows/x64/release/doorstop.dll instead of the x86 build. I had assumed that I needed to use x86.