Control Unity editors through Brokkr

This commit is contained in:
Meta Vens 2026-07-18 17:25:38 +01:00
commit 560c54771e
63 changed files with 312 additions and 215 deletions

View file

@ -131,11 +131,12 @@ fn main() -> Result<()> {
match command.as_str() {
"provider" | "smoke" => print_provider(),
"sync-contract" => print_sync_contract(),
"unity-command" => unity_command(UnityCommandArgs::parse(args.collect())?),
"sync-once" => sync_once(SyncArgs::parse(args.collect())?),
"sync-loop" => sync_loop(SyncLoopArgs::parse(args.collect())?),
_ => {
eprintln!(
"usage: brokkr-daemon [provider|smoke|sync-contract|sync-once --unity-cache PATH --blender-cache PATH [--dry-run]|sync-loop --unity-cache PATH --blender-cache PATH [--interval-ms N] [--max-passes N] [--dry-run]]"
"usage: brokkr-daemon [provider|smoke|sync-contract|unity-command --unity-cache PATH --action ACTION [--value VALUE] [--view game|scene] [--output PATH] [--width N] [--height N] [--command-id ID]|sync-once --unity-cache PATH --blender-cache PATH [--dry-run]|sync-loop --unity-cache PATH --blender-cache PATH [--interval-ms N] [--max-passes N] [--dry-run]]"
);
std::process::exit(2);
}
@ -180,6 +181,42 @@ fn sync_loop(args: SyncLoopArgs) -> Result<()> {
}
}
fn unity_command(args: UnityCommandArgs) -> Result<()> {
let command_id = args
.command_id
.unwrap_or_else(|| stable_id(["unity-command", &args.action, &chrono_like_timestamp_id()]));
let command = json!([
"brokkr.unity.command_intent.v0",
command_id,
args.action,
"",
"",
"",
"",
args.value,
"",
"",
"",
"",
"",
args.view_kind,
args.output_path,
args.width,
args.height
]);
let mut store = MirrorStore::open(&args.unity_cache)?;
let command_id = command[1]
.as_str()
.ok_or_else(|| anyhow!("generated Unity command has no command id"))?;
store.put_messagepack_document(
"brokkr.unity.command_intent.v0",
&format!("unity/commands/{command_id}"),
&command,
)?;
println!("{command_id}");
Ok(())
}
fn build_provider_advertisement() -> ProviderAdvertisement {
ProviderAdvertisement {
schema: PROVIDER_SCHEMA,
@ -222,6 +259,9 @@ fn build_provider_advertisement() -> ProviderAdvertisement {
"gameobject.create",
"component.attach",
"component.property.write",
"editor.assets.refresh",
"editor.lifecycle.write",
"editor.view.capture",
"sync.session.publish",
"sync.object.bind",
"sync.var.publish",
@ -501,6 +541,76 @@ struct SyncArgs {
dry_run: bool,
}
#[derive(Debug, Clone)]
struct UnityCommandArgs {
unity_cache: PathBuf,
action: String,
value: String,
view_kind: String,
output_path: String,
width: i64,
height: i64,
command_id: Option<String>,
}
impl UnityCommandArgs {
fn parse(args: Vec<String>) -> Result<Self> {
let mut unity_cache = None;
let mut action = None;
let mut value = String::new();
let mut view_kind = String::new();
let mut output_path = String::new();
let mut width = 0;
let mut height = 0;
let mut command_id = None;
let mut index = 0;
while index < args.len() {
let option = args[index].as_str();
index += 1;
let required_value = |index: usize| {
args.get(index)
.cloned()
.ok_or_else(|| anyhow!("{option} requires a value"))
};
match option {
"--unity-cache" => unity_cache = Some(PathBuf::from(required_value(index)?)),
"--action" => action = Some(required_value(index)?),
"--value" => value = required_value(index)?,
"--view" => view_kind = required_value(index)?,
"--output" => output_path = required_value(index)?,
"--width" => {
let raw = required_value(index)?;
width = raw
.parse()
.with_context(|| format!("invalid --width value: {raw}"))?;
}
"--height" => {
let raw = required_value(index)?;
height = raw
.parse()
.with_context(|| format!("invalid --height value: {raw}"))?;
}
"--command-id" => command_id = Some(required_value(index)?),
other => return Err(anyhow!("unknown unity-command argument: {other}")),
}
index += 1;
}
Ok(Self {
unity_cache: unity_cache
.ok_or_else(|| anyhow!("unity-command requires --unity-cache"))?,
action: action.ok_or_else(|| anyhow!("unity-command requires --action"))?,
value,
view_kind,
output_path,
width,
height,
command_id,
})
}
}
impl SyncArgs {
fn parse(args: Vec<String>) -> Result<Self> {
let parsed = ParsedSyncCli::parse(args, false)?;
@ -1992,6 +2102,52 @@ fn chrono_like_timestamp_id() -> String {
mod tests {
use super::*;
#[test]
fn unity_command_writes_typed_editor_lifecycle_intent() -> Result<()> {
let temp = tempfile::tempdir()?;
let cache = temp.path().join("unity-editor.ccmp");
let args = UnityCommandArgs::parse(vec![
"--unity-cache".into(),
cache.display().to_string(),
"--action".into(),
"captureEditorView".into(),
"--view".into(),
"scene".into(),
"--output".into(),
"artifacts/scene.png".into(),
"--width".into(),
"1280".into(),
"--height".into(),
"720".into(),
"--command-id".into(),
"capture-scene-test".into(),
])?;
unity_command(args)?;
let mut store = MirrorStore::open(&cache)?;
let document = store
.documents()?
.into_iter()
.find(|item| item.key == "unity/commands/capture-scene-test")
.expect("Unity editor command should be written");
assert_eq!(
field_string(&document.value, 2, "action").as_deref(),
Some("captureEditorView")
);
assert_eq!(
field_string(&document.value, 13, "viewKind").as_deref(),
Some("scene")
);
assert_eq!(
field_string(&document.value, 14, "outputPath").as_deref(),
Some("artifacts/scene.png")
);
assert_eq!(field_i64(&document.value, 15, "width"), Some(1280));
assert_eq!(field_i64(&document.value, 16, "height"), Some(720));
Ok(())
}
#[test]
fn provider_advertises_muninn_owned_quest_routes_for_unity() {
let provider = build_provider_advertisement();

View file

@ -26,6 +26,9 @@ Primary Eve surface id: `brokkr.eve.tool_broker.v0`
- `gameobject.create`
- `component.attach`
- `component.property.write`
- `editor.assets.refresh`
- `editor.lifecycle.write`
- `editor.view.capture`
- `command.receipt.publish`
- `eve.gui.publish`
- `eve.tui.publish`
@ -72,6 +75,10 @@ Primary sync documents:
Operational commands:
- `brokkr-daemon unity-command --unity-cache .brokkr/unity-editor.ccmp --action setEditorPlayState --value true`
- `brokkr-daemon unity-command --unity-cache .brokkr/unity-editor.ccmp --action setEditorPaused --value true`
- `brokkr-daemon unity-command --unity-cache .brokkr/unity-editor.ccmp --action refreshAssets`
- `brokkr-daemon unity-command --unity-cache .brokkr/unity-editor.ccmp --action captureEditorView --view scene --output artifacts/scene.png`
- `brokkr-daemon sync-once --unity-cache .brokkr/unity-editor.ccmp --blender-cache .brokkr/blender-editor.ccmp`
- `brokkr-daemon sync-loop --unity-cache .brokkr/unity-editor.ccmp --blender-cache .brokkr/blender-editor.ccmp --interval-ms 500`

View file

@ -1,5 +1,6 @@
using System;
using System.Globalization;
using System.IO;
using System.Linq;
using GameCult.Brokkr;
using UnityEditor;
@ -26,6 +27,10 @@ namespace GameCult.Brokkr.Editor
"createPrefabVariant" => CreatePrefabVariant(command),
"assignMaterial" => AssignMaterial(command),
"createScriptableObject" => CreateScriptableObject(command),
"refreshAssets" => RefreshAssets(command),
"setEditorPlayState" => SetEditorPlayState(command),
"setEditorPaused" => SetEditorPaused(command),
"captureEditorView" => CaptureEditorView(command),
_ => Failed(command, $"Unsupported Unity command action: {command.action}")
};
}
@ -35,6 +40,106 @@ namespace GameCult.Brokkr.Editor
}
}
private static BrokkrUnityCommandReceipt RefreshAssets(BrokkrUnityCommand command)
{
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
return Accepted(command, "Asset database refreshed.", "");
}
private static BrokkrUnityCommandReceipt SetEditorPlayState(BrokkrUnityCommand command)
{
if (!bool.TryParse(command.value, out var shouldPlay))
{
return Failed(command, "Play state value must be true or false.");
}
EditorApplication.isPlaying = shouldPlay;
return Accepted(command, shouldPlay ? "Entering Play mode." : "Leaving Play mode.", "");
}
private static BrokkrUnityCommandReceipt SetEditorPaused(BrokkrUnityCommand command)
{
if (!bool.TryParse(command.value, out var shouldPause))
{
return Failed(command, "Pause state value must be true or false.");
}
EditorApplication.isPaused = shouldPause;
return Accepted(command, shouldPause ? "Editor paused." : "Editor resumed.", "");
}
private static BrokkrUnityCommandReceipt CaptureEditorView(BrokkrUnityCommand command)
{
var camera = ResolveCaptureCamera(command.viewKind);
if (camera == null)
{
return Failed(command, $"No {command.viewKind} camera is available.");
}
if (string.IsNullOrWhiteSpace(command.outputPath))
{
return Failed(command, "Capture outputPath is required.");
}
var projectPath = Directory.GetParent(Application.dataPath)?.FullName ?? Application.dataPath;
var outputPath = Path.GetFullPath(Path.IsPathRooted(command.outputPath)
? command.outputPath
: Path.Combine(projectPath, command.outputPath));
var directory = Path.GetDirectoryName(outputPath);
if (!string.IsNullOrEmpty(directory))
{
Directory.CreateDirectory(directory);
}
var width = command.width > 0 ? command.width : Math.Max(camera.pixelWidth, 1);
var height = command.height > 0 ? command.height : Math.Max(camera.pixelHeight, 1);
var target = RenderTexture.GetTemporary(width, height, 24, RenderTextureFormat.ARGB32,
RenderTextureReadWrite.sRGB);
var previousTarget = camera.targetTexture;
var previousActive = RenderTexture.active;
try
{
camera.targetTexture = target;
camera.Render();
RenderTexture.active = target;
var image = new Texture2D(width, height, TextureFormat.RGBA32, false);
try
{
image.ReadPixels(new Rect(0, 0, width, height), 0, 0);
image.Apply(false, false);
File.WriteAllBytes(outputPath, image.EncodeToPNG());
}
finally
{
UnityEngine.Object.DestroyImmediate(image);
}
}
finally
{
camera.targetTexture = previousTarget;
RenderTexture.active = previousActive;
RenderTexture.ReleaseTemporary(target);
}
return Accepted(command, $"Captured {command.viewKind} view.", outputPath);
}
private static Camera ResolveCaptureCamera(string viewKind)
{
if (string.Equals(viewKind, "scene", StringComparison.OrdinalIgnoreCase))
{
return SceneView.lastActiveSceneView != null ? SceneView.lastActiveSceneView.camera : null;
}
if (string.Equals(viewKind, "game", StringComparison.OrdinalIgnoreCase))
{
return Camera.main ?? UnityEngine.Object.FindObjectsOfType<Camera>()
.FirstOrDefault(candidate => candidate.enabled);
}
return null;
}
private static BrokkrUnityCommandReceipt CreateGameObject(BrokkrUnityCommand command)
{
var gameObject = new GameObject(string.IsNullOrWhiteSpace(command.name)

View file

@ -23,6 +23,9 @@ namespace GameCult.Brokkr.Editor
"scene.tree.read",
"selection.read",
"asset.catalog.read",
"editor.assets.refresh",
"editor.lifecycle.write",
"editor.view.capture",
"command.palette.read",
"command.execute",
"receipt.read"
@ -43,6 +46,10 @@ namespace GameCult.Brokkr.Editor
.Select(item => item.name)
.ToArray(),
assetCount = AssetDatabase.GetAllAssetPaths().Length,
isPlaying = EditorApplication.isPlaying,
isPaused = EditorApplication.isPaused,
isCompiling = EditorApplication.isCompiling,
isUpdating = EditorApplication.isUpdating,
capabilities = Capabilities,
sceneObjects = CaptureSceneObjects(),
assets = CaptureAssets()

View file

@ -29,7 +29,7 @@
"Microsoft.Bcl.TimeProvider.dll",
"Microsoft.NET.StringTools.dll",
"MessagePack.Annotations.dll",
"MessagePack.CultMesh.dll",
"MessagePack.dll",
"R3.dll",
"System.Collections.Immutable.dll",
"System.IO.Pipelines.dll",

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 664ec081a56277e4c8c9d1efc3b6416f

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 7f7d43fe0ed322446a4ae5b345a4b1a9

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 384dd07098d548f4cb3cdd573cba2fac

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: be58f7171a27e4641bc5c1ece94e1a0e

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: be4ca9f17443d3b4ca054c236480ccac

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 544b484d57520474d8b31d232b87d5bd

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 9403fba97394ef941ab2ab830adb0bdf

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 5f5fad94e45028b4cb6a62b62252e1a4

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 941b8cae890bc58489c85b9a53eb0c52

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: af58bbde7fb10c74891cfc94811b25e9

View file

@ -1,27 +0,0 @@
fileFormatVersion: 2
guid: 36d3af9ac3f57cb46b1cbd574931f69c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 1
validateReferences: 0
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,27 +0,0 @@
fileFormatVersion: 2
guid: 28ef17d784838b64cb4be5ebdc1ee8a0
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 1
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: bddff633377fe234b85d00b3e2764100

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: d2cc82d315542004b91042f6dac44368

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: e68bfb4b774a27847b375e30c5ec3905

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: f3a6830e9cbbf7849a5b7f011ba74e51

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 72d7f2b2b7ff7634b81428b763b45852

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 426a8a696a5c1b94fbd9dfcc04786c7d

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: dea147d566e7d7b43a1b13c532cfcf0c

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: c2dc4cd724917584aa9b38f0a4bc669a

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 6f80ea203cf635b4584cb104fba83594

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 7bbc7179ab442cf44bf45ae6344c8766

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: d6474534f64e9594aa9cd78743056068

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 5f598b1f1749353408add83931bd042e

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 0ef728200a42c6a46b150b5a3143be6f

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: b3d0157e180a40942a31d7682f7c5674

View file

@ -23,6 +23,10 @@ namespace GameCult.Brokkr
[Key(11)] public string[] capabilities = Array.Empty<string>();
[Key(12)] public BrokkrGameObjectSnapshot[] sceneObjects = Array.Empty<BrokkrGameObjectSnapshot>();
[Key(13)] public BrokkrAssetSnapshot[] assets = Array.Empty<BrokkrAssetSnapshot>();
[Key(14)] public bool isPlaying;
[Key(15)] public bool isPaused;
[Key(16)] public bool isCompiling;
[Key(17)] public bool isUpdating;
}
[CultDocument("brokkr.unity.snapshot_receipt", "brokkr.unity.snapshot_receipt.v0")]
@ -159,6 +163,10 @@ namespace GameCult.Brokkr
[Key(10)] public string localPosition = "";
[Key(11)] public string localEulerAngles = "";
[Key(12)] public string localScale = "";
[Key(13)] public string viewKind = "";
[Key(14)] public string outputPath = "";
[Key(15)] public int width;
[Key(16)] public int height;
}
[MessagePackObject]

View file

@ -24,7 +24,7 @@
"Microsoft.Bcl.TimeProvider.dll",
"Microsoft.NET.StringTools.dll",
"MessagePack.Annotations.dll",
"MessagePack.CultMesh.dll",
"MessagePack.dll",
"R3.dll",
"System.Collections.Immutable.dll",
"System.IO.Pipelines.dll",

View file

@ -4,8 +4,10 @@
"displayName": "Brokkr",
"description": "Unity Editor adapter for the Brokkr CultMesh creative-tool broker.",
"unity": "2022.3",
"dependencies": {
"org.gamecult.cultlib": "1.0.16"
},
"author": {
"name": "GameCult"
}
}

View file

@ -12,22 +12,16 @@ Add this package to a Unity project's `Packages/manifest.json`:
"com.gamecult.brokkr": "file:E:/Projects/Brokkr/surfaces/unity/Packages/com.gamecult.brokkr"
```
Vendor the CultMesh runtime DLLs before opening Unity:
The host project must also resolve the released CultLib Unity package. For a
Git-based GameCult checkout, pin it explicitly in the same manifest:
```powershell
.\tools\vendor-cultmesh-unity.ps1
```json
"org.gamecult.cultlib": "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.16"
```
The vendor script intentionally copies the MessagePack runtime as
`MessagePack.CultMesh.dll` and removes any sibling `MessagePack.dll`. Unity
projects can already contain a `MessagePack.asmdef`, and importing a DLL with
the same filename makes Unity resolve the wrong assembly identity. Keep
`MessagePack.CultMesh.dll` and `MessagePack.Annotations.dll` on the same
MessagePack package version as CultMesh.
The script also removes `System.Numerics.Vectors.dll`. Unity provides that
facade assembly through its reference assemblies, so the package should not
ship a second facade DLL with a different identity.
Brokkr does not carry a private CultMesh runtime. The host's CultLib package is
the single transport assembly owner, so editor commands and the rest of the
project exchange the same typed documents in the same AppDomain.
Then open `GameCult > Brokkr`.
@ -40,6 +34,16 @@ In Unity:
3. Confirm `CultMesh Cache` points at `.brokkr/unity-editor.ccmp`.
4. Click `Start CultMesh Mirror`.
5. Click `Capture Snapshot`.
The editor bridge starts automatically and executes typed commands from the
same CultCache mirror. Common lifecycle commands can be issued without UI
automation:
```powershell
cargo run --manifest-path E:/Projects/Brokkr/brokkr-daemon/Cargo.toml -- unity-command --unity-cache .brokkr/unity-editor.ccmp --action setEditorPlayState --value true
cargo run --manifest-path E:/Projects/Brokkr/brokkr-daemon/Cargo.toml -- unity-command --unity-cache .brokkr/unity-editor.ccmp --action setEditorPaused --value true
cargo run --manifest-path E:/Projects/Brokkr/brokkr-daemon/Cargo.toml -- unity-command --unity-cache .brokkr/unity-editor.ccmp --action captureEditorView --view scene --output artifacts/scene.png
```
6. Click `Publish Mirror`.
7. To create a ScriptableObject through the mirror, fill `ScriptableObject Type`,
`Asset Name`, and `Asset Path`, then click `Create ScriptableObject Asset`.

View file

@ -49,31 +49,14 @@ try {
Assert-Contains $syncContractText "cinemachine-virtual-camera" "sync contract"
$pluginRoot = Join-Path (Get-Location) "surfaces\unity\Packages\com.gamecult.brokkr\Plugins\CultMesh"
$requiredDlls = @(
"GameCult.Caching.dll",
"GameCult.Caching.MessagePack.dll",
"GameCult.Mesh.dll",
"GameCult.Networking.dll",
"MessagePack.CultMesh.dll",
"MessagePack.Annotations.dll",
"R3.dll"
)
foreach ($dll in $requiredDlls) {
$path = Join-Path $pluginRoot $dll
if (-not (Test-Path $path)) {
throw "Missing vendored CultMesh Unity dependency: $path"
}
$vendoredDlls = @(Get-ChildItem $pluginRoot -Filter "*.dll" -ErrorAction SilentlyContinue)
if ($vendoredDlls.Count -ne 0) {
throw "Brokkr Unity package must consume the host CultLib package, not vendor transport DLLs: $($vendoredDlls.Name -join ', ')"
}
$staleMessagePackPath = Join-Path $pluginRoot "MessagePack.dll"
if (Test-Path $staleMessagePackPath) {
throw "Brokkr Unity package must not vendor MessagePack.dll; use MessagePack.CultMesh.dll to avoid colliding with Unity MessagePack.asmdef."
}
$staleVectorsPath = Join-Path $pluginRoot "System.Numerics.Vectors.dll"
if (Test-Path $staleVectorsPath) {
throw "Brokkr Unity package must not vendor System.Numerics.Vectors.dll; Unity provides the facade assembly and duplicate versions create resolver conflicts."
$brokkrPackage = Get-Content "surfaces\unity\Packages\com.gamecult.brokkr\package.json" -Raw | ConvertFrom-Json
if ($brokkrPackage.dependencies.'org.gamecult.cultlib' -ne '1.0.16') {
throw "Brokkr Unity package must declare org.gamecult.cultlib 1.0.16 as its transport owner."
}
$bundledPython = Join-Path $env:USERPROFILE ".cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe"

View file

@ -1,73 +0,0 @@
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$cultLibRoot = "E:\Projects\CultLib"
$pluginRoot = Join-Path $repoRoot "surfaces\unity\Packages\com.gamecult.brokkr\Plugins\CultMesh"
$staleUnityConflicts = @(
"MessagePack.dll",
"MessagePack.dll.meta",
"System.Numerics.Vectors.dll",
"System.Numerics.Vectors.dll.meta"
)
dotnet build (Join-Path $cultLibRoot "src\GameCult.Mesh\GameCult.Mesh.csproj") -c Debug
if ($LASTEXITCODE -ne 0) {
throw "CultMesh build failed with exit code $LASTEXITCODE"
}
New-Item -ItemType Directory -Force -Path $pluginRoot | Out-Null
$sources = @(
(Join-Path $cultLibRoot "bin\GameCult.Mesh\Debug\netstandard2.1\GameCult.Logging.dll"),
(Join-Path $cultLibRoot "bin\GameCult.Mesh\Debug\netstandard2.1\GameCult.Caching.dll"),
(Join-Path $cultLibRoot "bin\GameCult.Mesh\Debug\netstandard2.1\GameCult.Caching.MessagePack.dll"),
(Join-Path $cultLibRoot "bin\GameCult.Mesh\Debug\netstandard2.1\GameCult.Networking.dll"),
(Join-Path $cultLibRoot "bin\GameCult.Mesh\Debug\netstandard2.1\GameCult.Mesh.dll"),
"$env:USERPROFILE\.nuget\packages\concurrenthashset\1.3.0\lib\netstandard2.0\ConcurrentCollections.dll",
"$env:USERPROFILE\.nuget\packages\isopoh.cryptography.argon2\2.0.0\lib\netstandard2.0\Isopoh.Cryptography.Argon2.dll",
"$env:USERPROFILE\.nuget\packages\isopoh.cryptography.blake2b\2.0.0\lib\netstandard2.0\Isopoh.Cryptography.Blake2b.dll",
"$env:USERPROFILE\.nuget\packages\isopoh.cryptography.securearray\2.0.0\lib\netstandard2.0\Isopoh.Cryptography.SecureArray.dll",
"$env:USERPROFILE\.nuget\packages\litenetlib\2.1.2\lib\netstandard2.1\LiteNetLib.dll",
@{ Source = "$env:USERPROFILE\.nuget\packages\messagepack\3.1.7\lib\netstandard2.1\MessagePack.dll"; Target = "MessagePack.CultMesh.dll" },
"$env:USERPROFILE\.nuget\packages\messagepack.annotations\3.1.7\lib\netstandard2.0\MessagePack.Annotations.dll",
"$env:USERPROFILE\.nuget\packages\microsoft.bcl.asyncinterfaces\9.0.10\lib\netstandard2.1\Microsoft.Bcl.AsyncInterfaces.dll",
"$env:USERPROFILE\.nuget\packages\microsoft.bcl.timeprovider\8.0.0\lib\netstandard2.0\Microsoft.Bcl.TimeProvider.dll",
"$env:USERPROFILE\.nuget\packages\microsoft.net.stringtools\17.11.4\lib\netstandard2.0\Microsoft.NET.StringTools.dll",
"$env:USERPROFILE\.nuget\packages\r3\1.3.0\lib\netstandard2.1\R3.dll",
"$env:USERPROFILE\.nuget\packages\system.buffers\4.5.1\lib\netstandard2.0\System.Buffers.dll",
"$env:USERPROFILE\.nuget\packages\system.collections.immutable\8.0.0\lib\netstandard2.0\System.Collections.Immutable.dll",
"$env:USERPROFILE\.nuget\packages\system.componentmodel.annotations\5.0.0\lib\netstandard2.1\System.ComponentModel.Annotations.dll",
"$env:USERPROFILE\.nuget\packages\system.io.pipelines\9.0.10\lib\netstandard2.0\System.IO.Pipelines.dll",
"$env:USERPROFILE\.nuget\packages\system.memory\4.5.5\lib\netstandard2.0\System.Memory.dll",
"$env:USERPROFILE\.nuget\packages\system.runtime.compilerservices.unsafe\6.0.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll",
"$env:USERPROFILE\.nuget\packages\system.text.encodings.web\9.0.10\lib\netstandard2.0\System.Text.Encodings.Web.dll",
"$env:USERPROFILE\.nuget\packages\system.text.json\9.0.10\lib\netstandard2.0\System.Text.Json.dll",
"$env:USERPROFILE\.nuget\packages\system.threading.channels\8.0.0\lib\netstandard2.1\System.Threading.Channels.dll",
"$env:USERPROFILE\.nuget\packages\system.threading.tasks.extensions\4.5.4\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll"
)
foreach ($staleFile in $staleUnityConflicts) {
$stalePath = Join-Path $pluginRoot $staleFile
if (Test-Path $stalePath) {
Remove-Item -LiteralPath $stalePath -Force
}
}
foreach ($source in $sources) {
if ($source -is [System.Collections.IDictionary]) {
$sourcePath = $source.Source
$targetPath = Join-Path $pluginRoot $source.Target
}
else {
$sourcePath = $source
$targetPath = Join-Path $pluginRoot (Split-Path -Leaf $sourcePath)
}
if (!(Test-Path $sourcePath)) {
throw "Missing CultMesh Unity dependency: $sourcePath"
}
Copy-Item -LiteralPath $sourcePath -Destination $targetPath -Force
}
Write-Host "Vendored CultMesh Unity dependencies into $pluginRoot"