Unity editor knowledge
1. New project
- Open Unity Hub, click New Project, select 3D Template, or select a different version of the editor, as shown in the figure below. Enter the project name, select the project storage location, click 创建项目the button after confirmation, and the new project is created.
2. Interface layout
1) Toolbar
Unity's toolbar is mainly composed of icons, providing quick access to the most commonly used functions. The toolbar mainly includes the Transform tool, TransformGizmo switch, Play control, Layers drop-down list and Layout drop-down list.
- Transform (transformation) tool: mainly used in the Scene view, used to control and manipulate the scene and game objects. From left to right are the Hand tool, the Translate tool, the Rotate tool, and the Scale tool.
- Transform Gizmo toggle.
Center: used to change the pivot point of the game object (Center: change the pivot of the game object to the center of the bounding box of the object; Pivot: use the pivot of the object itself).
Global: Change the coordinates of the object (Global: world coordinates; Local: own coordinates). - Play (play) controls: users can freely switch between editing and game states, making game debugging and running more convenient and efficient. As shown below:
Note: In the playback mode, any modification operation of the game scene by the user is temporary, and any modification operation will be restored after the user exits the game preview mode.
- Layers drop-down list: Control the display of game objects in the Scene view, and the Scene view will display objects that are checked in the drop-down menu.
- Layout (layout) drop-down list: Switch the layout of the view, and the user can save the customized interface layout.
2) Menu bar
The menu bar mainly includes File, Edit, Assets, GameObject, Component, Windows, and Help.
- File menu: Contains functions such as scenes, saves, and outputs of projects and scenes.
Menu Item | use | hot key |
---|---|---|
New Scene | Create a new game scene | Ctrl+N |
Open Scene | Select the scene to open | Ctrl+O |
Save | save current scene | Ctrl+S |
Save as… | Save the currently saved scene as a new scene | Ctrl+Shift+S |
New Project… | Create a new project | |
Open Project… | open project | |
Save Project | save current project | |
Bulid Settings… | Setting Options Before Publishing Your Game | Ctrl+Shift+B |
Bulid And Run | Publish and run the game scene | Ctrl+B |
Exit | Quit Unity |
-
Edit menu: Contains a series of editing and environment setting operations on the scene and other commands.
-
Assets resources:
Create: Create scripts, Shaders, materials, animations, UI and other resources in the scene.
Show in Explorer: You can switch to the file directory of resource files.
Import New Asset...: Import new resources for the scene, such as models, materials, Shaders, etc.
Import Package: Import an existing resource package or load the resource package provided by the system by default.
Export Package: Package and export scene resources, either for a certain folder or resource, or for the entire project. -
GameObject game object/object: Game objects can be created, including lights, particles, models, GUI, etc.,
Menu Item | use | hot key |
---|---|---|
Create Empty | Create an empty game object to which various components can be added to generate corresponding types of game objects | Ctrl+Shift+N |
Create Other | Create other game objects, including particles in the scene, GUI, lights, standard model, physical model, etc. | |
Center On Children | The child object is homing to the center point of the parent object, and the parent object and the child object are selected at the same time, and the selected object will be automatically aligned to the axis | |
Make Parent | Create a parent-child relationship | |
Clear Parent | Clear the parent-child relationship, that is, cancel the parent-child binding relationship | |
Apply Changes To Perfab | Apply changes to presets | |
Break Perfab Instance | Cancel prefab instance | |
Move To View | Move the game object to the center point of the current view | Ctrl+Alt+F |
Align With View | Move the game object to align with the view, automatically move the selected object to the current view and align it with the current view as the center | Ctrl+Shift+F |
Align With to Selected | Align the mobile view with the game object, align the current view to the selected object, and align it with the center of the game object |
- Component component: A set of related properties used to add to game objects, including Add..., Mesh, Effects, Physics, Navigation, Audio, Rendering, Miscellaneous, etc.
Menu Item | use | hot key |
---|---|---|
Add… | Add components to the selected game object, and the types of components added to the game object can be freely combined | Ctrl+Shift+A |
Mesh | There are three types of grid components, Mesh Filter (add grid filter), Text Mesh (add text grid), Mesh Rendering (add grid renderer) | |
Effects | Special effect components, including Particle System (particle system component), Trail Renderer (trail rendering component), Line Render (line rendering component), Lens Flare (lens flare component), Halo (closed ring component), Projector (projection effect component) | |
Physics | Physics class components, used to set the physical properties of the model in the scene, including setting as rigid bodies, controllers, colliders, joints, forces, etc. | |
Navigation | Navigation components, used to add navigation functions to objects in the scene, including Nav Mesh Agent (navigation mesh agent), Off Mesh Link (separated mesh connection), Nav Mesh Obstacle (navigation mesh obstacle) | |
Audio | Audio components, used to add audio components and related filters, including Audio Listener (audio listener component), Audio Reverb Zone (audio mixing range component), Audio Low Pass Filter (audio low pass filter component), etc. | |
Rendering | Rendering components of the scene, including the scene, skybox, halo, GUI interface, etc. | |
Miscellaneous | 杂项组件,包括Animator(Mecanim动画系统组件,适合制作骨骼动画)、Animation(制作关键帧动画)、NetworkView(网格视图组件)、Wind Zone(风组件) |
- Terrain地形:方便用户直观地绘制场景地形,可以在场景中加入树木、草丛等效果。
菜单项 | 用途 | 快捷键 |
---|---|---|
Create Terrain | 创建一个地形平面 | |
Import Heightmap-Raw… | 导入高度图 | |
Export Heightmap-Raw… | 导出高度图 | |
Set Rresolution… | 设置地形分辨率,即可设置地形的长、宽、高、分辨率等信息 | |
Mass Place Trees… | 批量种植树木 | |
Flatten Heightmap… | 展平高度图 | |
Refresh Tree and Detail Protoypes | 刷新树以及预置细节 |
- Window窗口:包含各种的窗口切换、布局等,也可以打开各种视图、访问Unity的Asset Store资源商店。
菜单项 | 用途 | 快捷键 |
---|---|---|
Next Window | 切换下一个视图窗口 | Ctrl+Tab |
Previous Window | 切换上一个视图窗口 | Ctrl+Shift+Tab |
Layouts | 布局选项,在此菜单中可以控制布局的样式,也可自定义布局窗口、恢复默认布局 | |
Scene | 游戏场景设计面板 | Ctrl+1 |
Game | 游戏预览窗口 | Ctrl+2 |
Inspector | 属性查看面板 | Ctrl+3 |
Hierarchy | 显示游戏所有对象的面板 | Ctrl+4 |
Project | 显示项目资源列表的面板 | Ctrl+5 |
Animation | 动画编辑视图 | Ctrl+6 |
Profiler | Unity各类资源使用情况查看器 | Ctrl+7 |
Asset Store | Unity资源商店,用户可下载和出售资源 | Ctrl+9 |
Asset Server | 对资源进行版本管理 | Ctrl+0 |
Lightmapping | 烘焙窗口,对场景进行烘焙操作 | |
Occlusion Culling | 遮挡剔除 | |
Navigation | 导航 | |
Console | 控制台,进行错误排除等操作 | Ctrl+Shift+C |
三、视图
1)Project视图
Project(项目)视图是整个项目工程的资源汇总,包含了游戏场景中用到的脚本、材质、字体、贴图、外部导入的网络模型等所有的资源文件。
2)Hierarchy视图
- Hierarchy(层级)视图显示当前场景中用到的对象。在Hierarchy视图中按照字母顺序来排列对象,这需要用户有良好的命名规范,防止查找所需对象时不易查找。
- 因为在Scene视图中游戏对象容易被遮挡,所以需要在Hierarchy视图中操作,有利于资源的识别和管理。
- Hierarchy视图,如下图:
注:在Hierarchy视图中删除某个对象,该对象在当前游戏场景中被删除,但是并不会在项目中真正删除它,在Project视图中该对象仍存在。
3)Inspector视图
Inspector(检视)视图用于显示在游戏场景中所选择对象的详细信息以及游戏整体的属性设置,包括对象的名称、标签、位置坐标、旋转角度、缩放、组件等,如下图所示。
- Transform:用于修改对象的Position(位置)、Rotation(旋转)和Scale(缩放)3个属性。
- Mesh Filter(网格过滤器):用于从对象中获取网格信息,并将其传递到用于将其渲染到屏幕到Mesh Renderer当中。
- Mesh Renderer(网格渲染器):将Mesh Filter得到几何形状,根据游戏对象的Transform组件的定义位置进行渲染。
- Materials:设置对象材质。
4)Scene视图
Scene(场景)视图用于显示场景中所有用到的模型、光源、摄像机、材质、音效等,此视图中可对游戏对象通过可视化的方式进行编辑,如下图:
Commonly used operation methods in the Scene view :
Rotation operation : Press Alt+ 鼠标左键to rotate the scene with the current pivot point.
Move operation : press and hold 鼠标滚轮键or press Q键to move the scene.
Zoom operation : use 滚轮键, press Alt+鼠标右键to zoom in and zoom out the viewing angle.
Display the selected object in the center : Press F键to enlarge the selected game object in the center.
Flythrough mode : Press 鼠标右键+ W/A/S/D键to switch to this mode, which is used to allow users to fly through the Scene view in the first-person perspective.
5) Game view
The Game (game) view is used to preview the scene and cannot be edited. The complete game effect can be displayed in this view.