Skip to content

Commit 9a2059d

Browse files
committed
fix editor path
1 parent 3165db0 commit 9a2059d

File tree

1 file changed

+27
-30
lines changed

1 file changed

+27
-30
lines changed

composeRelease.sh

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -67,39 +67,36 @@ fi
6767

6868
# try to find unity executable
6969
unity_project_version_path="OneSignalExample/ProjectSettings/ProjectVersion.txt"
70-
unity_project_version=$(cat ${unity_project_version_path} | sed -n 's/^m_EditorVersion: //p')
71-
unity_versions_path="/opt/unity/Editor/Unity"
72-
unity_path="${unity_versions_path}/${unity_project_version}"
73-
74-
if [[ ! -d "${unity_versions_path}" ]]
75-
then
76-
echo "Could not find any versions of Unity installed at path: ${unity_versions_path}"
77-
exit 1
78-
elif [[ ! -d "${unity_path}" ]]
79-
then
80-
echo "Could not find Unity ${unity_project_version}"
81-
pushd "${unity_versions_path}" > /dev/null 2>&1
82-
83-
options=(* "Exit")
84-
PS3="Please select an installed Unity version: "
85-
select option in "${options[@]}"
86-
do
87-
if [[ "$option" = "Exit" ]]
88-
then
89-
exit 1
90-
elif [[ "${options[@]}" =~ "$option" ]]
91-
then
92-
echo "Using ${option}"
93-
unity_path="${unity_versions_path}/${option}"
94-
break
95-
fi
96-
done
70+
unity_project_version=$(cat "${unity_project_version_path}" | sed -n 's/^m_EditorVersion: //p')
71+
72+
# Unity project path from CI environment if available
73+
unity_project_path="${UNITY_PROJECT_PATH:-OneSignalExample}"
74+
75+
# Common installation locations (CI, macOS, local)
76+
unity_candidates=(
77+
"/opt/unity/Editor/Unity" # Linux runner (GitHub Actions)
78+
"/Applications/Unity/Hub/Editor/${unity_project_version}/Unity.app/Contents/MacOS/Unity" # macOS
79+
"/home/runner/Unity/Hub/Editor/${unity_project_version}/Editor/Unity" # legacy Linux path
80+
"/home/runner/Unity/Hub/Editor/${unity_project_version}/Unity.app/Contents/MacOS/Unity" # legacy macOS path
81+
)
82+
83+
unity_executable=""
84+
for candidate in "${unity_candidates[@]}"; do
85+
if [[ -x "$candidate" ]]; then
86+
unity_executable="$candidate"
87+
break
88+
fi
89+
done
9790

98-
popd > /dev/null 2>&1
91+
if [[ -z "$unity_executable" ]]; then
92+
echo "❌ Could not locate Unity executable for version ${unity_project_version}"
93+
echo "Checked the following paths:"
94+
printf ' - %s\n' "${unity_candidates[@]}"
95+
exit 1
96+
else
97+
echo "✅ Found Unity executable: ${unity_executable}"
9998
fi
10099

101-
unity_executable="${unity_path}/Unity.app/Contents/MacOS/Unity"
102-
103100
# VERSION file will act as the source of truth
104101
version_filepath="OneSignalExample/Assets/OneSignal/VERSION"
105102
current_version=$(cat "$version_filepath")

0 commit comments

Comments
 (0)