Skip to content

Commit d0484c6

Browse files
committed
add more log at unity failure
1 parent 402ad84 commit d0484c6

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

composeRelease.sh

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -277,22 +277,38 @@ executeUnityMethod() {
277277
local project_path=$1
278278
local build_target=$2
279279
local method_name=$3
280-
local log_path="${PWD}/logs/${method_name}-${build_target}-$(date +%Y%m%d%H%M%S).txt"
281-
282-
${unity_executable} -projectpath "${project_path}"\
283-
-quit\
284-
-batchmode\
285-
-nographics\
286-
-buildTarget "${build_target}"\
287-
-executeMethod "${method_name}"\
288-
-logFile "${log_path}"
289-
280+
local log_dir="${PWD}/logs"
281+
mkdir -p "${log_dir}"
282+
283+
local log_path="${log_dir}/${method_name}-${build_target}-$(date +%Y%m%d%H%M%S).txt"
284+
285+
echo "▶️ Running Unity method: ${method_name} (${build_target})"
286+
echo " Log file: ${log_path}"
287+
288+
# Clean up stale locks before running
289+
pkill -f Unity || true
290+
rm -f "${project_path}/Temp/UnityLockfile"
291+
292+
# Run Unity in batchmode
293+
"${unity_executable}" \
294+
-projectPath "${project_path}" \
295+
-quit \
296+
-batchmode \
297+
-nographics \
298+
-buildTarget "${build_target}" \
299+
-executeMethod "${method_name}" \
300+
-logFile "${log_path}"
301+
290302
local method_result=$?
291-
303+
292304
if [[ ${method_result} -ne 0 ]]; then
293-
echo "Unity method ${method_name}} failed with ${method_result}"
305+
echo "❌ Unity method ${method_name} failed with exit code ${method_result}"
306+
echo "----- Unity log tail (last 40 lines) -----"
307+
tail -n 40 "${log_path}" || echo "(no log file found)"
308+
echo "------------------------------------------"
294309
else
295-
echo "Unity method completed"
310+
echo "✅ Unity method ${method_name} completed successfully"
311+
echo " Full log: ${log_path}"
296312
fi
297313
}
298314

0 commit comments

Comments
 (0)