Skip to content

Instantly share code, notes, and snippets.

@fum1h1ro
Created January 22, 2021 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fum1h1ro/fd1b09c92192a893c24e0371f7f0aafd to your computer and use it in GitHub Desktop.
Save fum1h1ro/fd1b09c92192a893c24e0371f7f0aafd to your computer and use it in GitHub Desktop.
shaderconfig generator for HLSL Tools
#!/bin/sh
set -e
pwd
PACKAGE_LINK=.shaderIncludes/Packages
PACKAGE_CACHE=Unity/Library/PackageCache
if [ -d $PACKAGE_LINK ]; then
rm -rf $PACKAGE_LINK
fi
mkdir -p $PACKAGE_LINK
for package in $PACKAGE_CACHE/*; do
without_version=${package%@*}
link_name=${without_version#$PACKAGE_CACHE/}
echo $link_name
ln -s ../../$package $PACKAGE_LINK/$link_name
done
project_version_txt=`head -n 1 Unity/ProjectSettings/ProjectVersion.txt`
UNITY_VERSION=${project_version_txt#* }
echo $UNITY_VERSION
cat - << EOS > shadertoolsconfig.json
{
"hlsl.additionalIncludeDirectories": [
".",
"/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity/Contents/CGIncludes",
".shaderIncludes"
]
}
EOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment