-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclean-unity-library.sh
More file actions
executable file
·43 lines (39 loc) · 1.4 KB
/
Copy pathclean-unity-library.sh
File metadata and controls
executable file
·43 lines (39 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
# Restore Unity packages: remove Library (PackageCache) and any broken embedded
# copies of registry packages under Packages/com.unity.* that should NOT exist
# for this project (only manifest.json + packages-lock.json are in git).
#
# Usage from repo root: ./clean-unity-library.sh
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
PROJ="$ROOT/First Principles"
if [[ ! -d "$PROJ" ]]; then
echo "Expected Unity project at: $PROJ"
exit 1
fi
# Embedded registry packages that commonly get half-copied and break compile
# (missing UIToolkitInteroperabilityBridge, NUnitExtensions, orphan .meta, etc.)
for name in com.unity.ugui com.unity.test-framework; do
dir="$PROJ/Packages/$name"
if [[ -d "$dir" ]]; then
echo "Removing embedded package folder (will resolve from registry): $dir"
rm -rf "$dir"
fi
done
# Warn if other com.unity.* folders exist under Packages (unexpected for this repo)
shopt -s nullglob
for dir in "$PROJ/Packages"/com.unity.*; do
[[ -d "$dir" ]] || continue
echo "WARNING: Unexpected folder remains under Packages/: $dir"
echo " If you did not embed this on purpose, delete it and reopen Unity."
done
shopt -u nullglob
LIB="$PROJ/Library"
if [[ -d "$LIB" ]]; then
echo "Removing: $LIB"
rm -rf "$LIB"
else
echo "No Library folder at $LIB (skipped)."
fi
echo ""
echo "Done. Quit Unity if it was open, then reopen the project and wait for package restore."