G
GitIgnore.pro

Unity .gitignore Template & Complete Guide

Perfect .gitignore template for Unity projects. Ignore Library, Temp, Logs folders properly. Fix common Unity gitignore issues. Updated for Unity 2023+.

šŸš€ Unity .gitignore Template (2025)

# Unity .gitignore Template - Updated 2025

# Unity generated files
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
[Ll]ogs/
[Uu]ser[Ss]ettings/

# Unity cache and temporary files
*.tmp
*.temp
*.bak
*.swp
*~.nib
*.orig
*.rej

# Unity crash logs
CrashReports/

# Visual Studio cache files
*.cache
*.obj
*.suo
*.user
*.userosscache
*.sln.docstates
[Dd]ebug/
[Rr]elease/
[Aa]pp_[Dd]ata/

# Unity3d generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3d generated file on crash reports
sysinfo.txt

# MacOS
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Windows
Desktop.ini
$RECYCLE.BIN/

# JetBrains IDEs
.idea/
*.sln.iml

# Unity Package Manager
[Uu]nityPackageManager/log.txt

# Unity addressables
[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*

# Unity WebGL builds
WebGLBuilds/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity Cloud build
cloudbuild.txt

# Memorypack generated files
memorypack_generated/

# Rider
.idea/**
*.sln.iml

What Files Should Unity .gitignore Ignore?

āŒ Always Ignore

  • Library/ - Unity cache
  • Temp/ - Temporary files
  • Logs/ - Unity logs
  • UserSettings/ - User preferences
  • Build/ - Built executables

āœ… Always Keep

  • Assets/ - Your game assets
  • Packages/ - Package manifest
  • ProjectSettings/ - Project configuration
  • *.unity - Scene files
  • *.cs - Script files

šŸ”§ Fix Unity Gitignore Not Working

Problem: Library folder still being tracked

If Unity's Library folder is already in your repository, you need to remove it first:

git rm -r --cached Library/
git add .gitignore
git commit -m "Remove Library folder and update gitignore"

Problem: .gitignore file not found

The .gitignore file must be in your Unity project root (same level as Assets/ folder):

MyUnityProject/
ā”œā”€ā”€ Assets/
ā”œā”€ā”€ Library/
ā”œā”€ā”€ Packages/
ā”œā”€ā”€ ProjectSettings/
└── .gitignore  ← Must be here

Problem: Case sensitivity issues

Use both uppercase and lowercase patterns to handle different systems:[Ll]ibrary/ instead of just Library/

šŸ“‹ Unity Version Specific Notes

Unity 2022+

  • • UserSettings/ folder
  • • New Package Manager cache
  • • Updated build folders

Unity 2021

  • • Addressables cache
  • • WebGL build improvements
  • • Burst compiler cache

Unity 2020

  • • Package Manager logs
  • • Cloud Build files
  • • Legacy project files

šŸ‘„ Unity Team Collaboration Best Practices

āœ… Do Include

  • • All scripts (.cs files)
  • • Scene files (.unity)
  • • Prefabs and materials
  • • Package manifest files
  • • Project settings
  • • Custom editor scripts

āŒ Don't Include

  • • Personal IDE settings
  • • Local build outputs
  • • Cache and temp files
  • • User-specific preferences
  • • Platform-specific builds
  • • Debug symbols

ā“ Unity .gitignore FAQ

Should I ignore the Packages/ folder in Unity?

No, keep the Packages/manifest.json and Packages/packages-lock.json files. These define your project dependencies. However, you should ignore Packages/packages-cache/if it exists.

Why is my Unity project so large in Git?

You're probably tracking the Library/ folder. This contains Unity's cache and can be gigabytes. Add it to .gitignore and run git rm -r --cached Library/ to remove it from tracking.

Can I ignore meta files in Unity?

No! Meta files (.meta) are crucial for Unity. They contain import settings and asset references. Never add *.meta to your .gitignore. Only ignore specific generated meta files like *.pidb.meta.

What about Unity Hub projects?

Each Unity project needs its own .gitignore file in the project root. Unity Hub doesn't change the .gitignore requirements - each project is independent.