Resource Compiler (RC) VERSIONINFO auto-patcher for Unity made with rcedit (Windows).
Open Project Settings/Package Manager and add new scoped registry:
- Name:
KNOT - URL:
https://registry.npmjs.com - Scope(s):
com.knot
Open Window/Package Manager and install package from Packages: My Registries
- Open
Project Settings/KNOT/RC Patcher - Turn on
Patch on Build Post Processand add newBuild Post Processor - Modify
Target Filesfilter if neccesary. Only Target Files will be patched on build postprocess - Create and assign
Patcher Profileasset by pressingNewbutton or viaCreate/KNOT/RC Patcher/RC Patcher Profile - Make Windows build and check
Target Filesproperties 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());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") };
}
}
