Skip to content

Instantly share code, notes, and snippets.

@mathias-bevers
Forked from foriequal0/fix-unity-ndk-path.sh
Last active March 31, 2026 14:30
Show Gist options
  • Select an option

  • Save mathias-bevers/8abe4ca2273a278859e0b5ad6ee57d1d to your computer and use it in GitHub Desktop.

Select an option

Save mathias-bevers/8abe4ca2273a278859e0b5ad6ee57d1d to your computer and use it in GitHub Desktop.
Fix Unity NDK Path
#!/usr/bin/env bash
UNITY_HUB_EDITOR=${1:-$HOME/Unity/Hub/Editor}
pushd "$UNITY_HUB_EDITOR" > /dev/null
for UNITY in *; do
echo "Checking: $UNITY"
CLANGPP="$UNITY_HUB_EDITOR/$UNITY/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++"
if ! [ -f "$CLANGPP" ]; then
echo " Android Build Support is not installed"
continue
fi
LINKED_TO=$(readlink "$CLANGPP")
NDK_VERSION=$(sed -nE 's/^.*\/NDK\/(.*)\/toolchains\/.*$/\1/p' <<<"$LINKED_TO")
echo " NDK version detected: $NDK_VERSION"
pushd "$UNITY_HUB_EDITOR/$UNITY/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/" > /dev/null
echo " Making symlink"
ln -s ./ "./$NDK_VERSION"
popd > /dev/null
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment