Skip to content

Commit 9cf0625

Browse files
authored
support: unity package build script
1 parent d8df6a7 commit 9cf0625

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

.assets/scripts/create-unity-package.ps1

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ Set-Location (Split-Path $MyInvocation.MyCommand.Path)
1111
$solutionDir = Get-SolutionDirectory
1212
Set-Location $solutionDir
1313

14-
$packageName = "FixedMathSharp.$env:GitVersion_FullSemVer.unitypackage"
15-
$packagePath = "$solutionDir\$OutputPath\$packageName"
16-
1714
$fixedMathSharpPluginsPath = "$solutionDir\src\FixedMathSharp.Editor\bin\Release\net48"
1815
$unityProjectPath = "$solutionDir\FMS_UnityProject"
1916
$unityAssetsPath = "$unityProjectPath\Assets\FixedMathSharp"
2017
$unityPluginsPath = "$unityAssetsPath\Plugins"
18+
$packagePath = "$solutionDir\$OutputPath"
2119

2220
# Ensure a fresh Unity project by deleting the directory if it exists
2321
if (Test-Path $unityProjectPath) {
@@ -42,15 +40,16 @@ Copy-Item "$fixedMathSharpPluginsPath\*" $unityPluginsPath -Recurse -ErrorAction
4240
# Copy Unity editor-specific scripts to the Assets folder
4341
Copy-Item "$solutionDir\src\FixedMathSharp.Editor\Editor" $unityAssetsPath -Recurse -ErrorAction SilentlyContinue
4442

43+
$packageName = "FixedMathSharp.$env:GitVersion_FullSemVer.unitypackage"
4544
$unityExePath = "C:\Program Files\Unity\Hub\Editor\$env:UnityVersion\Editor\Unity.exe"
4645
$unityArgs = @(
4746
"-quit", # Quit after the operation completes
4847
"-batchmode", # Run in batch mode (no UI)
4948
"-projectPath", "$unityProjectPath", # Path to the Unity project
50-
"-exportPackage", "Assets", "$packagePath"
49+
"-exportPackage", "Assets", "$packagePath\$packageName"
5150
)
5251

53-
Write-Host "Packing to $packagePath..."
52+
Write-Host "Packing to $packagePath\$packageName..."
5453

5554
# Run Unity to create the package
5655
Start-Process $unityExePath -ArgumentList $unityArgs -Wait -NoNewWindow

0 commit comments

Comments
 (0)