Last active
February 1, 2023 08:50
-
-
Save citizenmatt/605850e97cf0c3a45fc5e137f8d953a7 to your computer and use it in GitHub Desktop.
Unity YAML file stats
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
# Count of .cs.meta files. Prefab, scene and asset file counts can be inferred from file lists | |
# Yeah, this is ugly. Don't care, you're only going to run it once | |
Write-Output "*.cs.meta: $((Get-ChildItem -recurse -filter *.cs.meta).Count)" | |
# Individual sizes of .unity, .prefab and .asset files | |
$results = Get-ChildItem -recurse | where {$_.extension -in ".unity", ".prefab", ".asset"} | Select-Object Name, Extension, Length | |
$results | Sort-Object -Property Extension | Out-Host | |
# | Out-File $destination | |
$results | Group-Object Extension | select Count, Name, @{l='Total Size'; e={$_.Group | Measure-Object -Property Length -Sum | select -expand Sum }} | Out-Host | |
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/local/bin/bash | |
# Delete $9 from the following lines to remove file names | |
echo ".unity file sizes" | |
find . -name '*.unity' -exec ls -l {} \; |awk '{ print $9 " " $5 }' | |
echo | |
echo ".prefab file sizes" | |
find . -name '*.prefab' -exec ls -l {} \; |awk '{ print $9 " " $5 }' | |
echo | |
echo ".asset file sizes" | |
find . -name '*.asset' -exec ls -l {} \; |awk '{ print $9 " " $5 }' | |
echo | |
find . -name '*.cs.meta' -exec ls -l {} \; | awk 'BEGIN {count=0;max=0;min=2147483647} { count+=1; Total += $5; min = (min < $5) ? min : $5; max = (max > $5) ? max : $5} END { printf ".cs.meta: %d total size: %d\n", count, Total }' | |
find . -name '*.unity' -exec ls -l {} \; | awk 'BEGIN {count=0;max=0;min=2147483647} { count+=1; Total += $5; min = (min < $5) ? min : $5; max = (max > $5) ? max : $5} END { printf ".unity: %d total size: %d\n", count, Total }' | |
find . -name '*.prefab' -exec ls -l {} \; | awk 'BEGIN {count=0;max=0;min=2147483647} { count+=1; Total += $5; min = (min < $5) ? min : $5; max = (max > $5) ? max : $5} END { printf ".prefab: %d total size: %d\n", count, Total }' | |
find . -name '*.asset' -exec ls -l {} \; | awk 'BEGIN {count=0;max=0;min=2147483647} { count+=1; Total += $5; min = (min < $5) ? min : $5; max = (max > $5) ? max : $5} END { printf ".asset: %d total size: %d\n", count, Total }' |
The stats.sh
file has been tested on Mac, not Linux. If you don't want to share filenames, remove the $9
parameter on lines 6, 10 and 14
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run this in the
Assets
folder.If you don't want to share filenames, remove the
Name
parameter in line #6