Home > Net >  git not actually saving Unity assets
git not actually saving Unity assets

Time:06-10

The last few months of development of our Unity game have been really annoying. We don't know exactly what happened or when, but all of a sudden there was a button that had its image gone missing, as well as a few text objects with their fonts go missing. We would fix them, do some code changes, commit and push to GitLab. My partner would pull the changes and the button/text object would be missing their things. Then a few objects would start having their scripts go missing. We would add the scripts/icons/fonts back to their right place, commit, push, pull they are still broken. We figured it was the fact that Unity does not auto save, as we are not the best at ctrl S like we should. Created a script that saves every minute. That did not fix it. The other day we made all the changes, File Save, File Save Project, closed unity, Commit, push, I deleted the project, Re-cloned it, these problems still persist.

We figure that it has something to do with GitLFS, .gitignore, or our .gitattributes. Any thoughts as to what could be reverting out changes? Bellow are our .gitignore and .gitattributes.

.gitignore

# Project Game Save files for when playing the game in the editor
/Assets/Saves

# Created by https://www.toptal.com/developers/gitignore/api/unity,rider,vs,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=unity,rider,vs,visualstudiocode

### Rider ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
ProjectSettings/RiderScriptEditorPersistedState.asset

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn.  Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1  serialized cache file
.idea/caches/build_file_checksums.ser

### Unity ###
# 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
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta

# 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*

# Visual Studio cache directory
.vs/

# Gradle cache directory
.gradle/

# 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

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

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.aab
*.unitypackage
*.app

# Crashlytics generated file

# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*

# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# Support for Project snippet scope

### vs ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.rsuser
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)

# Mono auto generated files
mono_crash.*

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/

# Visual Studio 2015/2017 cache/options directory
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# Visual Studio 2017 auto generated files
Generated\ Files/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# Benchmark Results
BenchmarkDotNet.Artifacts/

# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/

# StyleCop
StyleCopReport.xml

# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C   cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# Visual Studio Trace Files
*.e2e

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json

# Coverlet is a free, cross platform Code Coverage Tool
coverage*[.json, .xml, .info]

# Visual Studio code coverage results
*.coverage
*.coveragexml

# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/

# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs

# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak

# SQL Server files
*.mdf
*.ldf
*.ndf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl

# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# CodeRush personal settings
.cr/personal

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config

# Tabs Studio
*.tss

# Telerik's JustMock configuration file
*.jmconfig

# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs

# OpenCover UI analysis results
OpenCover/

# Azure Stream Analytics local run output
ASALocalRun/

# MSBuild Binary and Structured Log
*.binlog

# NVidia Nsight GPU debugger configuration file
*.nvuser

# MFractors (Xamarin productivity tool) working folder
.mfractor/

# Local History for Visual Studio
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/

# End of https://www.toptal.com/developers/gitignore/api/unity,rider,vs,visualstudiocode

.gitattributes

#
# Git attributes for Unity projects
#
# Compiled by Andrew Pullins
#
# Sources
# https://gist.github.com/webbertakken/ff250a0d5e59a8aae961c2e509c07fbc
# https://hextantstudios.com/unity-gitattributes/
# https://gist.github.com/nemotoo/b8a1c3a0f1225bb9231979f389fd4f3f
# https://github.com/alexkaratarakis/gitattributes/blob/master/Unity.gitattributes
# https://gist.github.com/bpesquet/4e28b431b673addef1774d497b614b33
# 

# 3D formats
*.3dm lfs-file
*.3ds lfs-file
*.abc lfs-file
*.blend lfs-file
*.c4d lfs-file
*.collada lfs-file
*.dae lfs-file
*.dfx lfs-file
*.dxf lfs-file
*.FBX lfs-file
*.fbx lfs-file
*.jas lfs-file
*.lws lfs-file
*.lwo lfs-file
*.lwo2 lfs-file
*.lxo lfs-file
*.ma lfs-file
*.max lfs-file
*.mb lfs-file
*.obj lfs-file
*.ply lfs-file
*.skp lfs-file
*.stl lfs-file
*.ztl lfs-file

# Audio formats
*.aif lfs-file
*.aiff lfs-file
*.it lfs-file
*.mod lfs-file
*.mp3 lfs-file
*.ogg lfs-file
*.rns lfs-file
*.reason lfs-file
*.s3m lfs-file
*.wav lfs-file
*.xm lfs-file

# Bundles and binaries
*.apk lfs-file
*.dll lfs-file
*.exe lfs-file
*.mdb lfs-file
*.pdb lfs-file
*.so lfs-file

# Compressed Archive
*.7z lfs-file
*.bz2 lfs-file
*.gz lfs-file
*.rar lfs-file
*.tar lfs-file
*.zip lfs-file

# Documents formats
*.pdf lfs-file

# ETC
*.a lfs-file9

# Ensure that text files that any contributor introduces to the repository have their line endings normalized
* text=auto

# Font formats
*.otf lfs-file
*.ttf lfs-file

# Image formats
*.afdesign lfs-file
*.afphoto lfs-file
*.ai lfs-file
*.bmp lfs-file
*.dds lfs-file
*.exr lfs-file
*.gif lfs-file
*.hdr lfs-file
*.iff lfs-file
*.jpeg lfs-file
*.jpg lfs-file
*.jpeg lfs-file
*.pict lfs-file
*.png lfs-file
*.psd lfs-file
*.svg lfs-file
*.tga lfs-file
*.tif lfs-file
*.tiff lfs-file
*.webp lfs-file
*.xcf lfs-file

# Increase probability of success for merging files with specific extensions
*.cs diff=csharp

# Macro attribute: Files with Unities yaml format
# linguist-generated means the file is ignored for the repository's language statistics and diffs are hidden by default.
[attr]unity-yaml-file -text -merge=unityamlmerge linguist-generated

# Macro attribute: Files intended for LFS
[attr]lfs-file filter=lfs diff=lfs merge=lfs -text

### Rider ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Spine export file for Unity
*.skel.bytes lfs-file

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn.  Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1  serialized cache file
.idea/caches/build_file_checksums.ser


# Unity binary files
*.bundle lfs-file
*.cubemap lfs-file
*.unitypackage lfs-file

# Unity files
*.asmdef unity-yaml-file -linguist-generated
*.anim unity-yaml-file
*.asset unity-yaml-file
*.brush unity-yaml-file
*.cginc  unity-yaml-file
*.controller unity-yaml-file
*.flare unity-yaml-file
*.fontsettings unity-yaml-file
*.giparams unity-yaml-file
*.guiskin unity-yaml-file
*.mask unity-yaml-file
*.mat unity-yaml-file
*.meta unity-yaml-file
*.mixer unity-yaml-file
*.overrideController unity-yaml-file
*.physicMaterial unity-yaml-file
*.physicsMaterial2D unity-yaml-file
*.playable unity-yaml-file
*.prefab unity-yaml-file
*.preset unity-yaml-file
*.renderTexture unity-yaml-file
*.shader unity-yaml-file
*.shadervariants unity-yaml-file
*.spriteatlas unity-yaml-file
*.terrainlayer unity-yaml-file
*.unity unity-yaml-file

# Unity Phisics files
# "physic" for 3D but "physics" for 2D
*.physicMaterial2D merge=unityyamlmerge
*.physicMaterial merge=unityyamlmerge
*.physicsMaterial2D merge=unityyamlmerge
*.physicsMaterial merge=unityyamlmerge

# Unity specific assets
*-[Nn]av[Mm]esh.asset lfs-file
*-[Tt]errain.asset lfs-file

# Video formats
*.asf lfs-file
*.avi lfs-file
*.flv lfs-file
*.mov lfs-file
*.mp4 lfs-file
*.mpeg lfs-file
*.mpg lfs-file
*.ogv lfs-file
*.wmv lfs-file
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# Support for Project snippet scope

# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,rider

CodePudding user response:

In the middle a line where it says

# Files built by Visual Studio
 *_i.c 
 *_p.c 
 *_h.h 
 *.ilk 
 *.meta

You have excluded all meta files. This means the assets will be there but it loses the link to them

  • Related