github/gitignore · Unity.gitignore

Unity .gitignore テンプレート解説

Unity.gitignore が Library・Temp・Obj・Build・Logs・UserSettings と自動生成される IDE ファイルを無視する理由、そして .meta ファイルを必ずコミットすべき理由を説明します。

ジェネレーターで開く VisualStudio, Windows, macOS, JetBrains と一緒に開く

Unity.gitignore は Unity プロジェクトのルートに置くことを前提としている。テンプレートのフォルダールールが /[Ll]ibrary/ のように / で始まり、プロジェクトルートに固定されているため、リポジトリのサブフォルダーに Unity プロジェクトがある場合はパスを合わせて修正する必要がある。

Unity エディターはアセットのインポート時に巨大なキャッシュ(Library)を作り、スクリプト IDE 用のソリューションファイルも自動生成する。このテンプレートはそうした再生成可能なファイルを防ぎ、AssetsPackagesProjectSettings だけが共有されるようにする。

ルール別の解説

パターン何を、なぜ無視するか
/[Ll]ibrary//[Tt]emp//[Oo]bj//[Ll]ogs/.utmp/エディターのキャッシュ・一時フォルダーアセットのインポート結果とコンパイルキャッシュである。数 GB になることもあり、Unity がプロジェクトを開くときに再作成する。
/[Bb]uild//[Bb]uilds/*.apk*.aab*.app*.unitypackageビルド結果プレイヤービルドとエクスポートしたパッケージである。配布ファイルはリポジトリではなくリリースで管理する。
/[Uu]ser[Ss]ettings/*.user*.userprefs*.suo.vs/個人設定エディターのレイアウトと個人設定、Visual Studio のユーザーファイルである。
*.csproj*.unityproj*.sln*.slnx自動生成される IDE ファイルUnity がスクリプトエディターのために毎回作り直すプロジェクト・ソリューションファイルである。コミットすると人によってパスが異なり、コンフリクトが頻発する。
*.pdb*.mdb*.pdb.meta*.mdb.metaデバッグシンボルMono・.NET のデバッグ情報とそのメタファイルである。
/ServerData/[Aa]ssets/StreamingAssets/aa*/[Aa]ssets/AddressableAssetsData/link.xml*Addressables・Visual Scripting の生成物Addressables のビルド結果と自動生成されるリンクファイルである。ビルドのたびに新しく作られる。
*.blend1*.blend1.metasysinfo.txtcrashlytics-build.properties/[Mm]emoryCaptures//[Rr]ecordings/その他Blender のバックアップファイル、クラッシュレポートの副産物、メモリプロファイラーのキャプチャ、Recorder の結果である。

実務での注意点

元のテンプレート

Unity.gitignoreルール 58 行
# This .gitignore file should be placed at the root of your Unity project directory## Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore## Recommended: add any editor/OS/tool-specific ignore rules from the Global/ templates as needed.# See: https://github.com/github/gitignore/tree/main/Global#.utmp//[Ll]ibrary//[Tt]emp//[Oo]bj//[Bb]uild//[Bb]uilds//[Ll]ogs//[Uu]ser[Ss]ettings/*.log# By default unity supports Blender asset imports, *.blend1 blender files do not need to be commited to version control.*.blend1*.blend1.meta# MemoryCaptures can get excessive in size.# They also could contain extremely sensitive data/[Mm]emoryCaptures/# Recordings can get excessive in size/[Rr]ecordings/# Uncomment this line if you wish to ignore the asset store tools plugin# /[Aa]ssets/AssetStoreTools*# Autogenerated Jetbrains Rider plugin/[Aa]ssets/Plugins/Editor/JetBrains*# Jetbrains Rider personal-layer settings*.DotSettings.user# Visual Studio cache directory.vs/# Gradle cache directory.gradle/# Autogenerated VS/MD/Consulo solution and project filesExportedObj/.consulo/*.csproj*.unityproj*.sln*.slnx*.suo*.tmp*.user*.userprefs*.pidb*.booproj*.svd*.pdb*.mdb*.opendb*.VC.db# Unity3D generated meta files*.pidb.meta*.pdb.meta*.mdb.meta# Unity3D generated file on crash reportssysinfo.txt# Mono auto generated filesmono_crash.*# Builds*.apk*.aab*.unitypackage*.unitypackage.meta*.app# Crashlytics generated filecrashlytics-build.properties# TestRunner generated filesInitTestScene*.unity*# Addressables default ignores, before user customizations/ServerData/[Aa]ssets/StreamingAssets/aa*/[Aa]ssets/AddressableAssetsData/link.xml*/[Aa]ssets/Addressables_Temp*# By default, Addressables content builds will generate addressables_content_state.bin# files in platform-specific subfolders, for example:# /Assets/AddressableAssetsData/OSX/addressables_content_state.bin/[Aa]ssets/AddressableAssetsData/*/*.bin*# Visual Scripting auto-generated files/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db.meta/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Core/Property Providers/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Core/Property Providers.meta# Auto-generated scenes by play mode tests/[Aa]ssets/[Ii]nit[Tt]est[Ss]cene*.unity*# UI Toolkit auto generated files/UIElementsSchema/# Auto-generated cache in Assets folder/[Aa]ssets/[Ss]ceneDependencyCache*

テンプレートの出典: github/gitignore/Unity.gitignore @356fd7b (2026-09-11) · CC0-1.0

一緒に使うテンプレート

ほかのテンプレートの解説