为什么要将 Unity Sprite Images 拆分到文件夹中?

Why split Unity Sprite Images into folders?

我是Unity的初学者。

我在学习的时候遇到了一个问题

将 Sprite 图片添加到资源时,

为什么要添加到Resources文件夹下的Sprite文件夹下?

不分文件夹,

直接将Sprite图像添加到Assets和将Sprite图像添加到Resources> Sprites有什么区别?

例如下图

Unity作为初学者,有很多疑问

我需要你的帮助。

如果您能简单地解释一下,我将不胜感激。

这主要有两个原因。首先是最明显的组织!即使对于小型游戏,您最终也会拥有成百上千种不同的资产和资产类型。比如脚本、场景、模型、字体等等。如果你把它们都放在同一个文件夹里,你就会失去理智,在你需要的时候试图检索你需要的东西。

但是,路径 Resources>Sprites 并不危险。文件夹 'Resources' 是 Special Folders 列表的一部分,具有特殊效果(我让你阅读简短文档)。

来自文档

You can load Assets on-demand from a script instead of creating instances of Assets in a Scene for use in gameplay. You do this by placing the Assets in a folder called Resources. Load these Assets by using the Resources.Load function.

You can have multiple Resources folders placed anywhere inside the Assets folder. Place the needed Asset files in a Resources folder or a subfolder within it. Always include the subfolder path in the path passed to the Resources.Load function if your Asset files are in subfolders.

Note that if the Resources folder is an Editor subfolder, the Assets in it are loadable from Editor scripts but are stripped from builds.

但文件夹 'Sprites' 由您决定。您可以随意命名。

没有区别。您可以将精灵图像放置在任何您想要的位置。这只是一种组织项目的方式。当您在 Unity 中工作一段时间后,您会明白为什么在文件夹中组织项目如此重要。资源还具有特殊功能,它在@MrDos 回答中有所描述。