Skip to content

Resource Compiler (RC) VERSIONINFO auto-patcher for Unity

License

Notifications You must be signed in to change notification settings

V0odo0/KNOT-RCPatcher

Repository files navigation

Resource Compiler (RC) VERSIONINFO auto-patcher for Unity made with rcedit (Windows).

Installation

Open Project Settings/Package Manager and add new scoped registry:

  • Name: KNOT
  • URL: https://registry.npmjs.com
  • Scope(s): com.knot

image

Open Window/Package Manager and install package from Packages: My Registries

image

Usage

  1. Open Project Settings/KNOT/RC Patcher
  2. Turn on Patch on Build Post Process and add new Build Post Processor
  3. Modify Target Files filter if neccesary. Only Target Files will be patched on build postprocess
  4. Create and assign Patcher Profile asset by pressing New button or via Create/KNOT/RC Patcher/RC Patcher Profile
  5. Make Windows build and check Target Files properties details. Done

See all possible properties:

https://learn.microsoft.com/en-us/windows/win32/menurc/versioninfo-resource?redirectedfrom=MSDN

//KnotRcPatcherProfile built-in property value placeholders
sb.Replace("<ProductVersion>", Application.version);
sb.Replace("<UnityVersion>", Application.unityVersion);
sb.Replace("<CompanyName>", Application.companyName);
sb.Replace("<BuildGuid>", Application.buildGUID);
sb.Replace("<ProductName>", Application.productName);
sb.Replace("<CurrentYear>", DateTime.UtcNow.Year.ToString());

Extending RC Patcher

Make your own patcher

[Serializable]
public class MyPatcher : IKnotRcPatcher
{
    public IEnumerable<string> GetTargetFileExtensions()
    {
        return new[] { "exe" };
    }

    public Task<KnotRcPatcherResult> Patch(IEnumerable<string> filePaths, IEnumerable<KeyValuePair<string, string>> properties, CancellationToken cancellationToken = default)
    {
        //Do my stuff

        return Task.FromResult(new KnotRcPatcherResult
        {
            FilesPatched = filePaths.ToList()
        });
    }
}

Make your own property provider

[Serializable]
public class MyPropertyProvider : IKnotRcPatcherPropertyProvider
{
    public IEnumerable<KeyValuePair<string, string>> GetProperties()
    {
        return new[] { new KeyValuePair<string, string>("MyKey", "MyValue") };
    }
}

About

Resource Compiler (RC) VERSIONINFO auto-patcher for Unity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages