com.knot.rcpatcher
v0.2.5
Published
Resource Compiler (RC) VERSIONINFO auto-patcher for Unity
Downloads
246
Readme
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
Open Window/Package Manager
and install package from Packages: My Registries
Usage
- Open
Project Settings/KNOT/RC Patcher
- Turn on
Patch on Build Post Process
and add newBuild Post Processor
- Modify
Target Files
filter if neccesary. Only Target Files will be patched on build postprocess - Create and assign
Patcher Profile
asset by pressingNew
button or viaCreate/KNOT/RC Patcher/RC Patcher Profile
- 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") };
}
}