对于一个学校项目,我和其他 14 个人正在 Unity 中制作游戏。对于这个项目,我们使用了几个包,对于这个问题很重要的是 TextMeshPro 和来自 Unity 的新输入系统。为了修复我们遇到的几个错误,我们不得不修改这些包中的 2 个代码文件,并且组中的每个人都需要这些文件。问题是这些文件位于 Unity 的 Library 文件夹中,我读到有几个人说不要将此文件夹推送到 github 以防止合并冲突。
所以我的问题是:在这种特定情况下,我是否将库文件夹推送到 github?
最佳答案
回答你的标题
否
决定这一点的最简单方法是使用“官方” .gitignore
for Unity来自 GitHub 本身。
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Mm]emoryCaptures/
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
# 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
*.unitypackage
# Crashlytics generated file
crashlytics-build.properties
如您所见
Library
文件夹是第一个被忽略的东西,有充分的理由(见 Iggy's answer)。可能的异常(exception)
然而就个人而言,这是有道理的 给我 还要保留
.asset
来自 Library
中的文件文件夹。这有点不方便,但这里存储了诸如 Buildsettings、TargetPlatform 等内容,因此您不必在每次克隆时手动切换它。所以我总是将此异常(exception)添加到
.gitignore
!/[Ll]ibrary/*.asset
在我对 Cleaning up and Migrating existing Unity project into new one or another PC 的回答中阅读更多相关信息.
回答您的实际问题
我不知道你的 TMP 有什么样的错误,但你不应该改变包中的任何代码 完全 !
正如您所指出的,这只是临时更改,如果它们完全被存储并且没有被 PackageManager 立即恢复!
来自 this post Unity Technologies 的官方回答是
Yes, currently [May 22, 2019] the way to develop a package is to copy/move it [from the
Library
folder] to your project'sPackages
folder.
这会将包转换为嵌入式包,您现在可以更改并与
Packages
一起推送。文件夹。
关于unity3d - 我应该将 Unity Library 文件夹推送到 Github,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59742994/