Importing Assets 导入资源

Date:2011-08-08

Unity will automatically detect files as they are added to your Project folder's Assets folder. When you put any asset into your Assets folder, you will see the asset appear in your Project View.

Unity将自动检测添加到项目文件夹的资源文件夹中的文件。当你把任何资源放到资源文件夹中的时候,你会看到资源出现在你的项目视图中。

Importing Assets(导入资源)
The Project View is your window into the Assets folder, normally accessible from the file manager
项目视图是你进入资源文件夹的窗口,通常从文件管理器访问

When you are organizing your Project View, there is one very important thing to remember:

当你组织你的项目视图时,要记住很重要的一条:

Never move any assets or organize this folder from the Explorer (Windows) or Finder (OS X). Always use the Project View!

切勿从资源管理器(Windows)或探测器(OS X)移动任何资源或组织安排该文件夹,而始终使用项目视图来完成!

There is a lot of meta data stored about relationships between asset files within Unity. This data is all dependent on where Unity expects to find these assets. If you move an asset from within the Project View, these relationships are maintained. If you move them outside of Unity, these relationships are broken. You'll then have to manually re-link lots of dependencies, which is something you probably don't want to do.

在Unity内存储着很多资源文件之间的关系的元数据,这些数据全都依赖于Unity可以在哪里找到这些资源。如果你从项目视图中移动资源,这些关系会得以维持。如果你在Unity之外移动它们则会破坏这种关系,然后,你必须手动重新连接大量的相关性,你可能并不希望这样做。

So just remember to only save assets to the Assets folder from other applications, and never rename or move files outside of Unity. Always use Project View. You can safely open files for editing from anywhere, of course.

所以要谨记,只能将来自其他程序的资源保存到资源文件夹,不要在Unity之外重命名或移动文件,始终使用项目视图。当然,你可以从任何地方安全地打开文件进行编辑。

Creating and Updating Assets 创建和更新资源

When you are building a game and you want to add a new asset of any type, all you have to do is create the asset and save it somewhere in the Assets folder. When you return to Unity or launch it, the added file(s) will be detected and imported.

当你正在创建一个游戏并且想要添加任何类型的新资源,你所要做的就是创建资源并将它保存到资源文件夹的某处。当你返回Unity或启动它,添加的文件已被检测并导入。

Additionally, as you update and save your assets, the changes will be detected and the asset will be re-imported in Unity. This allows you to focus on refining your assets without struggling to make them compatible with Unity. Updating and saving your assets normally from its native application provides optimum, hassle-free workflow that feels natural.

此外,当你更新并保存你的资源时,更改将被检测到并且资源将重新导入Unity。这使你能够专注于改善你的资源而不需努力使它们与Unity兼容。通过原生应用程序提供最佳的、无忧的、自然的工作流程,来更新并保存你的资源。

Asset Types 资源类型

There are a handful of basic asset types that will go into your game. The types are:

有少数基础的资源类型将进入你的游戏,这些类型包括:

  • Mesh Files & Animations 网格文件&动画
  • Texture Files 纹理文件
  • Sound Files 声音文件

We'll discuss the details of importing each of these file types and how they are used.

我们将讨论每个文件类型导入的细节,以及如何使用它们。

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 see this page.

无论你是使用哪种3D软件,Unity将从每个文件导入网格和动画。Unity所支持的应用程序列表,请参阅此页

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 page about Animation Import.

你的网格文件并不需要有一个要导入的动画。如果你使用动画,你可以选择从一个单一文件导入所有动画,或者导入分离的文件,每一个动画。有关导入动画的更多信息,请参见动画导入

Once your mesh is imported into Unity, you can drag it to the Scene or Hierarchy to create an instance of it. You can also add Components to the instance, which will not be attached to mesh file itself.

一旦你的网格导入到Unity中,你可以拖动它到场景视图或层次视图中来创建它的一个实例。你也可以为该实例添加组件,而不会被附加到网格文件本身。

Meshes will be imported with UVs and a number of default Materials (one material per UV). You can then assign the appropriate texture files to the materials and complete the look of your mesh in Unity's game engine.

网格将随UV和一些默认材质(每UV一材质)被导入。然后,你可以在Unity游戏引擎中分配适当的纹理文件给材质并且完成你的网格外观。

Textures 纹理

Unity supports all image formats. Even when working with layered Photoshop files, they are imported without disturbing the Photoshop format. This allows you to work with a single texture file for a very care-free and streamlined experience.

Unity支持所有图像格式,即使是分层的Photoshop文件,它们都可以导入,而不影响Photoshop格式。这可以让你在使用一个单独纹理文件的工作中,带来愉快和高效的体验。

You should make your textures in dimensions that are to the power of two (e.g. 32x32, 64x64, 128x128, 256x256, etc.) Simply placing them in your project's Assets folder is sufficient, and they will appear in the Project View.

你应该使用的纹理尺寸是2的升幂(如32x32,64x64,128x128,256x256等),只需将它们放入项目资源文件夹中就足够了,它们将出现在项目视图中。

Once your texture has been imported, you should assign it to a Material. The material can then be applied to a mesh, Particle System, or GUI Texture. Using the Import Settings, it can also be converted to a Cubemap or Normalmap for different types of applications in the game. For more information about importing textures, please read the Texture Component page.

一旦你的纹理已经被导入,你应该将其分配给材质。材质可以被应用到一个网格、粒子系统、或GUI纹理。使用导入设置,它也可以在游戏中为不同类型的应用而被转换成一个立方体贴图或法线贴图。有关导入纹理的更多信息,请阅读纹理组件

Sounds 声音

Desktop

Unity features support for two types of audio: Uncompressed Audio or Ogg Vorbis. Any type of audio file you import into your project will be converted to one of these formats.

Unity的特色是支持两种类型的音频:无压缩音频或Ogg Vorbis。任何类型的音频文件导入到你的项目中将被转换为这些格式之一。(Ogg是一种先进的有损的音频压缩技术,正式名称是Ogg Vorbis,是一种免费的开源音频格式。OGG编码格式远比MP3先进,它可以在相对较低的数据速率下实现比MP3更好的音质。)

File Type Conversion 文件类型转换

  • .AIFF
    Converted to uncompressed audio on import, best for short sound effects.
    转换为无压缩音频导入,最适合短音效果。
  • .WAV
    Converted to uncompressed audio on import, best for short sound effects.
    转换为无压缩音频导入,最适合短音效果。
  • .MP3
    Converted to Ogg Vorbis on import, best for longer music tracks.
    转换成Ogg格式导入,最适合较长的音乐曲目。
  • .OGG
    Compressed audio format, best for longer music tracks.
    压缩音频格式,最适合较长的音乐曲目。

Import Settings 导入设置

If you are importing a file that is not already compressed as Ogg Vorbis, you have a number of options in the Import Settings of the Audio Clip. Select the Audio Clip in the Project View and edit the options in the Audio Importer section of the Inspector. Here, you can compress the Clip into Ogg Vorbis format, force it into Mono or Stereo playback, and tweak other options. There are positives and negatives for both Ogg Vorbis and uncompressed audio. Each has its own ideal usage scenarios, and you generally should not use either one exclusively.

如果要导入一个尚未压缩为Ogg 格式的文件,你有一些选项,在音频剪辑的导入设置中。在项目视图中选择音频剪辑,在检视视图中编辑音频导入的选项。在这里,你可以压缩剪辑成Ogg格式,强制单声道或立体声播放,还可以调整其他选项。积极地或者消极地使用Ogg 格式和无压缩音频格式。每个人都有自己理想的使用习惯,你通常不应该只使用其中之一。

Read more about using Ogg Vorbis or Uncompressed audio on the Audio Clip Component Reference page.

了解更多有关使用Ogg 格式或无压缩音频格式,参考Audio Clip Component Reference page

iOS

Unity features support for two types of audio: Uncompressed Audio or MP3 Compressed audio. Any type of audio file you import into your project will be converted to one of these formats.

Unity的特色是支持两种类型的音频:无压缩音频或MP3压缩音频。任何类型的音频文件导入到你的项目中将被转换为这些格式之一。

File Type Conversion

  • .AIFF
    Imports as uncompressed audio for short sound effects. Can be compressed in Editor on demand.
    导入为无压缩音频,适用于短音效。可以在编辑器中按需求压缩。
  • .WAV
    Imports as uncompressed audio for short sound effects. Can be compressed in Editor on demand.
    导入为无压缩音频,适用于短音效。可以在编辑器中按需求压缩。
  • .MP3
    Imports as Apple Native compressed format for longer music tracks. Can be played on device hardware.
    导入为MP3压缩格式,适用于较长的音乐曲目。
  • .OGG
    OGG compressed audio format, incompatible with the iPhone device. Please use MP3 compressed sounds on the iPhone.
    OGG音频压缩格式, 与iPhone设备不兼容,请使用MP3压缩格式代替。

Import Settings

When you are importing an audio file, you can select its final format and choose to force it to stereo or mono channels. To access the Import Settings, select the Audio Clip in the Project View and find Audio Importer under Inspector tab. Here, you can compress the Clip into Ogg Vorbis format, force it into Mono or Stereo playback, and tweak other options, like very important Decompress On Load setting.

当你导入一个音频文件,你可以选择它的最终格式,并选择强制立体声或单声道。要进入导入设置,在项目视图中选择音频剪辑,在检视视图中找到音频导入选项。在这里,你可以压缩成Ogg格式,强制单声道或立体声播放,并调整其他选项,比如很重要的加载时解压设置。

Read more about using MP3 Compressed or Uncompressed audio on the Audio Clip Component Reference page.

了解更多关于使用MP3格式或无压缩音频,参考Audio Clip Component Reference page

Android

Unity features support for two types of audio: Uncompressed Audio or MP3 Compressed audio. Any type of audio file you import into your project will be converted to one of these formats.

Unity的特色是支持两种类型的音频:无压缩音频或MP3压缩音频。任何类型的音频文件导入到你的项目中将被转换为这些格式之一。

File Type Conversion 文件类型转换

  • .AIFF
    Imports as uncompressed audio for short sound effects. Can be compressed in Editor on demand.
    导入为无压缩音频,适用于短音效。可以在编辑器中按需求压缩。
  • .WAV
    Imports as uncompressed audio for short sound effects. Can be compressed in Editor on demand.
    导入为无压缩音频,适用于短音效。可以在编辑器中按需求压缩。
  • .MP3
    Imports as MP3 compressed format for longer music tracks.
    导入为MP3压缩格式,适用于较长的音乐曲目。
  • .OGG
    OGG compressed audio format, is incompatible with some Android devices, so Unity does not support it for Android platform. Please use MP3 compressed sounds instead.
    OGG压缩音频格式,与某些Android设备不兼容,因此Unity不支持在Android平台使用这种格式。请使用MP3格式来代替。

Import Settings 导入设置

When you are importing an audio file, you can select its final format and choose to force it to stereo or mono channels. To access the Import Settings, select the Audio Clip in the Project View and find Audio Importer under Inspector tab. Here, you can compress the Clip into Ogg Vorbis format, force it into Mono or Stereo playback, and tweak other options, like very important Decompress On Load setting.

当你导入一个音频文件,你可以选择它的最终格式,并选择强制立体声或单声道。要进入导入设置,在项目视图中选择音频剪辑,在检视视图中找到音频导入选项。在这里,你可以压缩成Ogg格式,强制单声道或立体声播放,并调整其他选项,比如很重要的加载时解压设置。

Read more about using MP3 Compressed or Uncompressed audio on the Audio Clip Component Reference page.

了解更多关于使用MP3格式或无压缩音频,参考Audio Clip Component Reference page

Once sound files are imported, they can be attached to any GameObject. The Audio file will create an Audio Source Component automatically when you drag it onto a GameObject.

一旦声音文件被导入,它们可以被附加到任何游戏对象上。当你将它拖到一个游戏对象上时,音频文件将自动创建一个音频源组件

页面最后更新:2010-09-17

分类:Manual|评论: 0|浏览: 312 翻译: 第七把剑
评论
暂无评论
发表评论
用户名:

评论审核后才会显示!