importing:[Unity官方文档翻译]Importing Assets 如何向unity导入资源

Importing Assets

导入资源

Assets created outside of Unity must be brought in to Unity by having the file either saved directly into the

 “Assets” folder of your project, or copied into that folder. For many common formats, you can save your

 source file directly into your project’s Assets folder and Unity will be able to read it. Unity will notice

 when you save new changes to the file and will re-import as necessary.


Unity外部造的资源有两种导入到unity的方法,直接保存到”Asset”文件,或者直接复制到”Asset”文件。一般格式的资源文件直接保存到“Source”文件夹,unity都能识别。当你的“Source”文件夹发生了新的改变时,unity编辑器界面将会提示你正在重新导入资源。


When you create a Unity Project, you are creating a folder - named after your project - which 

contains the following subfolders:


你创建的unity工程实际上是一个文件夹,在你工程项目名称文件下面有这些子文件夹。


The basic file structure of a Unity Project

Unity项目的基础文件夹结构。

The Assets folder is where you should save or copy files that you want to use in your project.

The contents of the Project Window in Unity shows the items in your Assets folder. So if 

you save or copy a file to your Assets folder, it will be imported and become visible in your Project Window.


资源文件夹是你保存和复制项目所要用的文件的地方。

Unity项目视窗的内容就是展示你的资源文件夹内的东西。所以如果你保存或者复制了文件到你的资源文件夹,它会再一次导入,并且出现在你项目视窗上。

 

Unity will automatically detect files as they are added to Assets folder, or if they are modified. When you

 put any asset into your Assets folder, you will see the asset appear in your Project View.


Unity会自动检查你添加到资源文件夹的文件,或者是修改了的文件。当你放一些资源到资源文件夹时,你将发现这些资源自动出现在你的项目视窗中。


The Project Window shows assets that have been imported into your project

If you drag a file into Unity’s Project Window from your computer (eg, from the Finder on Mac, or from

 Explorer on Windows), it will be copied into your Assets folder, and will appear in the Project window.


如果你拖一个文件到项目视窗中,它会被复制到资源文件夹内,然后出现在你的项目视窗里。


The items you see in your Project window represent (in most cases) actual files on your computer, and

 if you delete them within Unity, you are deleting them from your computer too.


出现在你项目视窗的文件代表了(大多数情况下如此)在你电脑内存在的真实文件,如果你在Unity里

删除了它们,那也意味着删除了电脑里的本地文件。


The relationship between the Assets Folder in your Unity Project on your computer, and the Project

 Window within Unity

在你的电脑上和在unity编辑器内的你的资源文件夹的关系


The above image shows an example of a few files and folders inside the Assets folder of a Unity project. 

You can create as many folders as you like and use them to organise your Assets.


上面的这张图表示了unity项目里的一些文件和文件夹的一个例子。你可以随意创造数量的文件夹来使你的资源文件夹下井井有条。

You’ll notice in the image above that there are .meta files listed in the file system, but not visible in Unity’s 

Project Window. Unity creates these .meta files for each asset and folder, but they are hidden by default,

 so you may not see them in your Explorer/Finder either.


也许你发现了上图中存在于文件系统中的.meta文件。但是却没出现在你的unity里的项目视窗中。Unity为每一个资源和文件夹创建一个.meta文件,并且默认隐藏。所以你在文件浏览窗也看不见它们。


They contain important information about how the asset is used in the project and they must stay with the 

asset file they relate to, so if you move or rename an asset file in Explorer/Finder, you must also move/rename 

the meta file to match.


这些.meta文件包含了它们在项目中如何使用的重要的信息,所以它们必须和同名文件待在一起。所以如果你在文件浏览器中移动或重命名了这些文件,你也要对.meta文件执行相同的操作。

The simplest way to safely move or rename your assets is to always do it from within Unity’s project folder.

 This way, Unity will automatically move or rename the corresponding meta file. If you like, you can 

read more about .meta files and what goes on behind-the-scenes during the import process.

操作这些文件最安全的方法就是在Unity编辑器下操作它们。在这种方式下,Unity将会自动移动或重命名相对应的.meta文件。如果你喜欢的话,可以在这个网站阅读更多关于.meta文件的信息:behind-the-scenes during the import process.

 

If you want to bring collections of assets into your project, you can use Asset Packages. See Asset Packages for more details.

如果你想往你的工程添加一组资源,你可以使用资源包Asset Packages,浏览更多资源包的信息:Asset Packages 

 

Some common types of Asset

一些常见资源类型

Image Files

图像文件

Most common image file types are supported, such as BMP, TIF, TGA, JPG, and PSD. If you save 

your layered Photoshop (.psd) files into your Assets folder, they will be imported as flattened images. 

You can find out more about importing images with alpha channels from photoshop, or importing your images as sprites


Unity能支持大多数普通图片格式比如说BMP、TIF, TGA, JPG, 和PSD格式。如果你直接以psd格式保存图层文件到你的资源文件夹,它们会被导入成平面图像。你可以在这个网站浏览更多:importing images with alpha channels from photoshop, or importing your images as sprites

3D Model Files

3D模型文件

If you save your 3D files from most common 3D software packages in their native format

 (eg, .max, .blend, .mb, .ma) into your Assets folder, they will be imported by calling back to

 your 3D package’s FBX export plugin (*). Alternatively you can export as FBX from your

 3D app into your Unity project. Read more about importing 3D files from your 3D app.


如果你从大多数主流3D软件以它们的本地格式导入3D模型到你的unity资源文件夹,那么Unity会回调3D软件的FBX导出插件,使它们以FBX格式导入,你也可以手动将它们以FBX格式从你的3D建模软件导出到unity中去,了解更多:importing 3D files from your 3D app.

 

Meshes & Animations

网格和动画

Whichever 3D package you are using, Unity will import the meshes and animations from each file. 

For a list of applications that are supported by Unity, please seethis page.

无论你使用哪一个3D包,unity都能支持从包中导入网格和动画。查看unity支持的3D软件列表请跳到:this page.


Your mesh file does not need to have an animation to be imported. If you do use animations, you have your

 choice of importing all animations from a single file, or importing separate files, each with one animation. 

For more information about importing animations, please see of the manual.

如果你只使用动画的话,那么没必要从网格文件中一个一个导入动画。你可以选择从一个单独的文件导入所有的动画。或者导入单独的只有一个动画的网格文件。浏览更多关于导入动画的信息,请查阅unity手册。

 

Audio Files

音频文件

If you save uncompressed audio files into your Assets folder, they will be imported according to the

 compression settings specified. Read more about importing audio files.

如果你向资源文件夹导入未压缩的音频文件,它们将会被自动以压缩状态导入。阅读更多:importing audio files.

Other Asset Types

其他的资源类型

In all cases, your original source file is never modified by Unity, even though within Unity you can often

 choose between various ways to compress, modify, or otherwise process the asset. The import process

 reads your source file, and creates a game-ready representation of your asset internally, matching your

 chosen import settings. If you modify the import settings for an asset, or make a change to the source

 file in the Asset folder, will cause Unity to re-import the asset again to reflect your new changes.


在所有的unity项目里,即使在unity里,你可以对资源进行多种压缩修改或其他操作。但unity都从不会修改你的原始源头文件夹。导入资源操作会读取你的资源文件夹,同时在内部对你的资源进行一个准备使用的标识,并且设置好你选择的导入设置。如果你对一个资源文件修改了导入设置,或改变了资源文件夹下的源头文件。将导致unity对你的资源进行重新导入以匹配你的选项。


Note: Importing native 3D formats requires the 3D application to be installed on the same computer as

 Unity. This is because Unity uses the 3D application’s FBX exporter plug-in to read the file. Alternatively, 

you can directly export as FBX from your application and save into the Projects folder.


注意:导入3D软件本地的3D格式的文件,需要在安装了unity的电脑上同时安装这个3D软件。因为unity需要使用3D软件的FBX导出插件来读出这个文件。当然你也可以选择直接从3D软件中直接导出为FBX文件然后保存到项目文件夹中。

See also:


同时可以参阅:

· Asset Packages

· Importing Meshes

· 3D formats

· Animation Import

· Materials and Shaders

· Textures and Videos

· Sprite Editor

· Sprite Packer

· Procedural Materials

· Audio Files

· Tracker Modules

 

相关推荐

相关文章