Skip to content

Commit 5f4f136

Browse files
committed
fix: testing project generation.
1 parent 0ba6242 commit 5f4f136

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

.github/workflows/generate-unity-project-files.yml

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,52 @@ jobs:
2727
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
2828
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
2929
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
30-
with:
31-
buildMethod: UnityEditor.SyncVS.SyncSolution
30+
31+
- name: Find Unity Editor
32+
run: |
33+
set -e
34+
35+
# Common Unity Editor locations when using game-ci
36+
POSSIBLE_LOCATIONS=(
37+
"/opt/unity-editor/Editor/Unity"
38+
"/opt/unity/Editor/Unity"
39+
"/opt/Unity/Editor/Unity"
40+
"/usr/bin/unity-editor"
41+
"$HOME/Unity/Hub/Editor" # If Unity Hub is present
42+
)
43+
44+
# Search for the Unity executable
45+
UNITY_PATH=""
46+
for path in "${POSSIBLE_LOCATIONS[@]}"; do
47+
if [[ -x "$path" ]]; then
48+
UNITY_PATH="$path"
49+
break
50+
fi
51+
done
52+
53+
# If Unity was installed via Unity Hub, find the latest installed version
54+
if [[ -d "$HOME/Unity/Hub/Editor" && -z "$UNITY_PATH" ]]; then
55+
UNITY_PATH=$(find "$HOME/Unity/Hub/Editor" -maxdepth 2 -name "Unity" -type f -executable | sort -V | tail -n 1)
56+
fi
57+
58+
# Output the result
59+
if [[ -z "$UNITY_PATH" ]]; then
60+
echo "Unity Editor not found!" >&2
61+
exit 1
62+
else
63+
echo "Unity Editor found at: $UNITY_PATH"
64+
echo "UNITY_PATH=$UNITY_PATH" >> $GITHUB_ENV
65+
fi
66+
67+
68+
- name: Generate Solution Files
69+
run: |
70+
unity-editor -batchmode -quit -nographics -logFile -executeMethod UnityEditor.SyncVS.SyncSolution
71+
72+
73+
74+
- name: List Generated Files (Debugging)
75+
run: ls -la
3276

3377
- name: Upload Solution Files
3478
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)