惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
T
Threatpost
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Tenable Blog
AWS News Blog
AWS News Blog
Know Your Adversary
Know Your Adversary
TaoSecurity Blog
TaoSecurity Blog
P
Palo Alto Networks Blog
Spread Privacy
Spread Privacy
I
Intezer
Security Latest
Security Latest
The Last Watchdog
The Last Watchdog
Google DeepMind News
Google DeepMind News
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
N
News and Events Feed by Topic
O
OpenAI News
A
Arctic Wolf
S
Secure Thoughts
Attack and Defense Labs
Attack and Defense Labs
N
News and Events Feed by Topic
M
MIT News - Artificial intelligence
F
Full Disclosure
P
Privacy International News Feed
The GitHub Blog
The GitHub Blog
T
Troy Hunt's Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
H
Hacker News: Front Page
aimingoo的专栏
aimingoo的专栏
S
Security @ Cisco Blogs
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Apple Machine Learning Research
Apple Machine Learning Research
Engineering at Meta
Engineering at Meta
Cloudbric
Cloudbric
大猫的无限游戏
大猫的无限游戏
Google Online Security Blog
Google Online Security Blog
Recent Announcements
Recent Announcements
H
Help Net Security
量子位
V
V2EX
美团技术团队
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
S
Schneier on Security
V2EX - 技术
V2EX - 技术
D
Docker
博客园 - 【当耐特】
Project Zero
Project Zero
博客园 - 司徒正美

博客园 - 野生西瓜

[Unity 杂货铺] SpriteAtlas 和 SBP 打包 [Unity 杂货铺] 游戏字体选择 [Unity 杂货铺] Git 配置与实践 [Unity 杂货铺] 引擎版本的选择 [Unity] 基础寻路算法 - 环境搭建 [Unity] 引擎脚本相关的字符串优化 [Unity] 基础寻路算法 - 代码实践 [Unity] 资源工作流程 - AssetPostprocessor [Unity] 资源工作流程 - ScriptedImporter [Unity] 资源工作流程 - 辅助工具 [Lua游戏AI开发指南] 笔记零 - 框架搭建 [GAME] [Civilization] 文明6字体及字体大小修改 [Unity] 编辑器运行中动态编译执行C#代码 [Unity] 在软件标题栏显示工作路径 [GAMEDEV] 个人开发如何找到合适的图片素材? [施工中] 博客导航 2021 的书 [BACKUP] Visual Studio Code 配置 [theHunterCOTW] 猎人荒野的召唤-一点资料
[Unity 杂货铺] 游戏项目的结构规划与初始化
野生西瓜 · 2026-03-31 · via 博客园 - 野生西瓜

1 前言

仅作存档,尽量简洁,备忘即可。不详细说明每个步骤,部分内容与先前文章有重复。

目前采用单一仓库的方式,将所有相关代码、资源、文档和工具整合到一个Git仓库中,将来看情况是否需要分成多个仓库。

Unity 项目框架,尝试使用 TEngine: https://github.com/Alex-Rachel/TEngine ,主要是包含了 HybridCLR + YooAsset + 目录结构 + 启动流程。

但也要注意版本和兼容情况,整体结构不要堆积得太复杂,看能否裁剪拆卸掉不需要的部分,或者自己去导入第三方插件而不是使用整合包。

2 目录结构

MelonGame/                   	   # 仓库根目录
│
├── .gitignore                     # Git忽略配置
├── README.md                      # 项目总说明文档
├── LICENSE                        # 许可证文件
│
├── Unity/                         # Unity主工程目录
│   ├── Assets/
│   ├── ProjectSettings/
│   ├── Packages/
│   ├── UserSettings/
│   ├── obj/
│   ├── Library/
│   ├── Logs/
│   └── Temp/
│
├── ArtProjects/                   # 美术工程源文件
│   ├── Blender/
│   │   ├── Characters/
│   │   ├── Environments/
│   │   ├── Props/
│   │   └── Exports/              # 导出文件目录
│   │
│   ├── Photoshop/
│   │   ├── UI/
│   │   ├── Textures/
│   │   ├── Icons/
│   │   └── Exports/
│   │
│   ├── Substance/
│   │   ├── Materials/
│   │   └── Exports/
│   │
│   ├── Fmod/                      # 音频项目
│   │   ├── Events/
│   │   ├── Banks/
│   │   └── Exports/
│   │
│   └── Spine/                     # Spine动画
│       ├── Animations/
│       └── Exports/
│
├── Documentation/                 # 项目文档
│   ├── Design/                    # 策划文档
│   │   ├── GameDesignDocument.md
│   │   ├── Mechanics/
│   │   ├── Balancing/
│   │   └── Progression/
│   │
│   ├── Technical/                 # 技术文档
│   │   ├── Architecture/
│   │   ├── APIs/
│   │   ├── Guidelines/
│   │   └── Backend/
│   │
│   ├── Art/                       # 美术文档
│   │   ├── StyleGuide/
│   │   ├── AssetPipeline/
│   │   └── References/
│   │
│   └── Production/                # 生产文档
│       ├── Milestones/
│       ├── Roadmap/
│       └── MeetingNotes/
│
├── Tools/                         # 开发工具和脚本
│   ├── EditorTools/               # Unity编辑器工具
│   │   ├── CustomInspectors/
│   │   ├── BuildAutomation/
│   │   └── AssetPipeline/
│   │
│   ├── BuildTools/                # 构建工具
│   │   ├── CI_CD/
│   │   ├── Deployment/
│   │   └── Packaging/
│   │
│   ├── ExternalTools/             # 第三方工具
│   │   ├── TextureCompressors/
│   │   ├── ModelOptimizers/
│   │   └── BatchProcessors/
│   │
│   └── UtilityScripts/            # 实用脚本
│       ├── Python/
│       ├── Shell/
│       └── PowerShell/
│
├── Config/                        # 配置文件
│   ├── GameConfig/                # 游戏配置
│   │   ├── Balancing/
│   │   ├── Localization/
│   │   └── GameSettings/
│   │
│   ├── EditorConfig/              # 编辑器配置
│   │   ├── Unity/
│   │   ├── VS_Code/
│   │   └── IDE_Settings/
│   │
│   └── BuildConfig/               # 构建配置
│       ├── Android/
│       ├── iOS/
│       └── Desktop/
│
├── Tests/                         # 测试相关
│   ├── UnitTests/
│   ├── IntegrationTests/
│   ├── PlayModeTests/
│   └── PerformanceTests/
│
├── ThirdParty/                    # 第三方库和插件
│   ├── Plugins/
│   ├── SDKs/
│   └── Libraries/
│
└── .github/                       # GitHub配置
    ├── workflows/
    ├── ISSUE_TEMPLATE/
    └── PULL_REQUEST_TEMPLATE/
Assets/
├── AssetArt/              # 美术资源目录
│   └── Atlas/            # 自动生成图集目录
├── AssetRaw/             # 热更资源目录
│   ├── UIRaw/            # UI 图片目录
│   │   ├── Atlas/        # 需要自动生成图集的 UI 素材目录
│   │   └── Raw/          # 不需要自动生成图集的 UI 素材目录
│   ├── Audios/           # 音频资源
│   ├── Effects/          # 特效资源
│   └── Scenes/           # 场景资源
├── Editor/               # 编辑器脚本目录
├── HybridCLRData/        # HybridCLR 相关目录
├── Scenes/               # 主场景目录
├── TEngine/              # 框架核心目录
│   ├── Editor/           # TEngine 编辑器核心代码
│   ├── Runtime/          # TEngine 运行时核心代码
│   └── AssetSetting/     # YooAsset 资源设置
└── GameScripts/          # 程序集目录
    ├── Main/             # 主程序程序集(启动器与流程)
    └── HotFix/           # 游戏热更程序集目录
        ├── GameBase/     # 游戏基础框架程序集 [Dll]
        ├── GameProto/    # 游戏配置协议程序集 [Dll]
        └── GameLogic/    # 游戏业务逻辑程序集 [Dll]
            ├── GameApp.cs                  # 热更主入口
            └── GameApp_RegisterSystem.cs   # 热更主入口注册系统

3 初始化 Git

3.1 设置 Asset Serialization 为 Force Text

打开 Edit -> Project Settings,选中左侧 Editor,右侧 Asset Serialization 设置为 Force Text。

3.2 设置 Version Control Mode 为 Visible Meta Files

打开 Edit -> Project Settings,选中左侧 Version Control,右侧 Mode 设置为 Visible Meta Files。

3.3 创建 .gitignore 文件

在 Unity 项目的根目录,即 Assets 的同级目录下,创建 .gitignore 文件:

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

# Mono auto generated files
mono_crash.*

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

# Crashlytics generated file
crashlytics-build.properties

# TestRunner generated files
InitTestScene*.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*

3.4 创建 .gitattributes 文件

参考“Git 配置与实践”,在 Unity 项目的根目录,创建 .gitattributes 文件

3.5 初始化本地仓库

在 Unity 项目的根目录,执行命令:<font style="color:rgb(25, 27, 31);">git init</font>

3.6 提交和推送文件

执行命令:

git add .
git commit -m "Init Project."
git branch -M main
git remote add origin <repository-url>
git push -u origin main

4 插件安装

4.1 安装 HotReload 插件

https://hotreload.net/

4.2 安装 com.unity.ide.windsurf

Github 仓库:https://github.com/Asuta/com.unity.ide.windsurf

Unity -> Window -> Package Manager -> Add package from git URL

5 参考资料

https://github.com/Alex-Rachel/TEngine

https://github.com/Cysharp/UniTask

https://www.yooasset.com/

https://github.com/tuyoogame/YooAsset

https://www.hybridclr.cn/