-
-
Save brianpeiris/b98f2a235e1d96c88130c6c8b49978fb to your computer and use it in GitHub Desktop.
Find scene and prefab references to scripts in Unity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Run from the project root. Pass the full name of a script, or substring of the names of the scripts to check. | |
# | |
# Example | |
# $) ./findrefs.sh BackgroundCamera | |
# Finding matches for script Assets/Scripts/Camera/BackgroundCamera.cs.meta ... | |
# Assets/Prefabs/CaveBGCamera.prefab: m_Script: {fileID: 11500000, guid: 7e63acfee367c4314852b87218149bd3, type: 3} | |
# Assets/Prefabs/ForestBGCamera.prefab: m_Script: {fileID: 11500000, guid: 7e63acfee367c4314852b87218149bd3, type: 3} | |
# | |
# $) | |
find_refs() { | |
echo "Finding matches for script $1 ..." | |
local guid="$(grep guid "$line" | sed 's/^.* //')" | |
grep -R "$guid" Assets | grep -v "$1" | |
echo "" | |
} | |
find Assets -iname "*$1*.cs.meta" | while read line; do | |
find_refs "$line" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment