Tip of the day

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 
* When move a GameObject, hold the Key '''v''',will fast align.
 
* When move a GameObject, hold the Key '''v''',will fast align.
  按住V键,移动GameObject,可以快速对齐
 
 
* A skinned character updates its vertices every frame, even when not animating. To freeze a skinned character in place without making it disappear or revert to a T-pose, set its <tt>SkinnedMeshRenderer.bones</tt> field to <tt>null</tt>.
 
* A skinned character updates its vertices every frame, even when not animating. To freeze a skinned character in place without making it disappear or revert to a T-pose, set its <tt>SkinnedMeshRenderer.bones</tt> field to <tt>null</tt>.
  蒙皮角色每帧都会更新它的顶点,甚至不播放动画.为了冻结一个蒙皮角色而不让它消失或还原到凝固姿势,将SkinnedMeshRenderer.bones设为null.
 
 
* There are two really nice hotkeys to insert or delete array elements in the inspector. SHIFT + DEL will delete the selected element and CTRL + D will duplicate it. SHIFT is only needed for reference types like GameObject[].
 
* There are two really nice hotkeys to insert or delete array elements in the inspector. SHIFT + DEL will delete the selected element and CTRL + D will duplicate it. SHIFT is only needed for reference types like GameObject[].
  在检视器中有2个相对好用的插入项和删掉项的快捷键,Shift+Del删除选中的项目和Ctrl+D复制项.Shift用于引用类型像GameObject[].
 
 
* If you are dealing with deep hierarchies you can hold down the ALT button when toggling expansion of an item, to recursively toggle the tree.
 
* If you are dealing with deep hierarchies you can hold down the ALT button when toggling expansion of an item, to recursively toggle the tree.
  如果你想打开深层次可以按住Alt键再展开项.
 
 
* When you're using Debug.Log or related methods, provide the instance of the script so you can click the log output and have the relevant object selected in editor! '''Debug.Log("Test", this);'''
 
* When you're using Debug.Log or related methods, provide the instance of the script so you can click the log output and have the relevant object selected in editor! '''Debug.Log("Test", this);'''
  当使用Debug.Log或相关的方法时,你可以点击输出记录编辑器中会选中相关的物体!
 
 
* If you're placing objects in the screen and want them to "snap" into place (great for placing items on the ground) you can hold the Command key (Control on Windows) while dragging the object's axis (snap increments are defined in [http://unity3d.com/support/documentation/Manual/Learning%20the%20Interface.html Edit->Snap Settings])
 
* If you're placing objects in the screen and want them to "snap" into place (great for placing items on the ground) you can hold the Command key (Control on Windows) while dragging the object's axis (snap increments are defined in [http://unity3d.com/support/documentation/Manual/Learning%20the%20Interface.html Edit->Snap Settings])
  如果你在屏幕上放置物体并想让它们对齐(对在地面上放置物体有效),可以在拖拽轴线时按住Command(windows是Control)键(对齐设置在[http://unity3d.com/support/documentation/Manual/Learning%20the%20Interface.html Edit->Snap Settings])
 
 
* Importing classes in JavaScript. Tired of writing '''Debug.Log''' and '''SendMessageOptions.DontRequireReceiver'''? Did you know that static members of classess and enums can be imported just like importing namespaces. Simply add '''import UnityEngine.Debug;''' and '''import UnityEngine.SendMessageOptions''' and then you can write '''Log("my log string")''' and '''SendMessage("ApplyDamage",2.0,DontRequireReceiver);'''.
 
* Importing classes in JavaScript. Tired of writing '''Debug.Log''' and '''SendMessageOptions.DontRequireReceiver'''? Did you know that static members of classess and enums can be imported just like importing namespaces. Simply add '''import UnityEngine.Debug;''' and '''import UnityEngine.SendMessageOptions''' and then you can write '''Log("my log string")''' and '''SendMessage("ApplyDamage",2.0,DontRequireReceiver);'''.
  想在Javascript中导入类,避免写Debug.Log及SendMessageOptions.DontRequireReceiver?知道导入类静态成员及枚举正如导入命名空间.仅仅需要加入import UnityEngine.Debug及import UnityEngine.SendMessageOptions,之后就可以写Log("my log string")及SendMessage("ApplyDamage",2.0,DontRequireReceiver).
 
 
* Deleting objects. Use Command + Backspace in the Scene, Hierarchy and Project views to remove objects. In the Scene and Hierarchy views this will just remove the selected instance of the object. In the Project view this will remove the selected object file and put it in your system Trash.
 
* Deleting objects. Use Command + Backspace in the Scene, Hierarchy and Project views to remove objects. In the Scene and Hierarchy views this will just remove the selected instance of the object. In the Project view this will remove the selected object file and put it in your system Trash.
  删除物体.在场景,层次和项目视图中使用Command+Backspace键,在场景和层次视图中仅仅是删除选中物体的实例.在项目视图将删除选中的物体并将其放进你系统的回收站.
 
 
* If you need some textures, like font textures, to not be affected by [http://unity3d.com/Documentation/ScriptReference/Texture-masterTextureLimit.html Texture.masterTextureLimit], disable Generate Mip Maps in the texture's import settings.  On the down side, this can adversely affect clarity of rendering at smaller scales.
 
* If you need some textures, like font textures, to not be affected by [http://unity3d.com/Documentation/ScriptReference/Texture-masterTextureLimit.html Texture.masterTextureLimit], disable Generate Mip Maps in the texture's import settings.  On the down side, this can adversely affect clarity of rendering at smaller scales.
 
 
 
* Boo has some handy [http://boo.codehaus.org/Builtin+Functions+Summary built-in functions] like [http://boo.codehaus.org/Builtin+Functions+Summary#BuiltinFunctionsSummary-shell shell()], [http://boo.codehaus.org/Builtin+Functions+Summary#BuiltinFunctionsSummary-join join()] and [http://boo.codehaus.org/Builtin+Functions+Summary#BuiltinFunctionsSummary-reversed reversed()]. And the cool part? They are available from JavaScript as well.
 
* Boo has some handy [http://boo.codehaus.org/Builtin+Functions+Summary built-in functions] like [http://boo.codehaus.org/Builtin+Functions+Summary#BuiltinFunctionsSummary-shell shell()], [http://boo.codehaus.org/Builtin+Functions+Summary#BuiltinFunctionsSummary-join join()] and [http://boo.codehaus.org/Builtin+Functions+Summary#BuiltinFunctionsSummary-reversed reversed()]. And the cool part? They are available from JavaScript as well.
 
* Every built-in component in the inspector has a small question mark in the right of it's heading. That's the quickest way to open the context-help for that component. It's your friend.
 
* Every built-in component in the inspector has a small question mark in the right of it's heading. That's the quickest way to open the context-help for that component. It's your friend.
  在inspector中每个内置组件在它的右侧都有一个小问号标记.这是打开组件帮助的最快的方式.你应该熟记它.
 
 
* To remember which color means what on an axis in Unity, just remember the mnemonic: RGB = XYZ.
 
* To remember which color means what on an axis in Unity, just remember the mnemonic: RGB = XYZ.
  为了记住Unity中轴线的颜色.只要记住 RGB = XYZ.
 
 
* You can use keyboard shortcuts for Edit->Load Selection and Edit->Save Selection to speed up the selection of commonly used parts in your scene.
 
* You can use keyboard shortcuts for Edit->Load Selection and Edit->Save Selection to speed up the selection of commonly used parts in your scene.
  你可以使用Edit->Load Selection和Edit->Save Selection的快捷键来快速切换你场景中常使用的物体.
 
 
* If you option-click an object in your hierarchy, the entire hierarchy within it will expand and unexpand.
 
* If you option-click an object in your hierarchy, the entire hierarchy within it will expand and unexpand.
  如果你按住option(alt)然后在层次中点击,可以将层次整个的展开或折叠.
 
 
* You can write Editor scripts to greatly reduce project-specific tedium when making something with Unity.  These are just as easy to write as regular scripts, and can save you a lot of hassle. See the [[Wizard_Archive|Wizard Archive]] for some examples.
 
* You can write Editor scripts to greatly reduce project-specific tedium when making something with Unity.  These are just as easy to write as regular scripts, and can save you a lot of hassle. See the [[Wizard_Archive|Wizard Archive]] for some examples.
  使用Unity你可以写Editor脚本来降低特殊项目的枯燥.跟写一个正常脚本一样,可以减少很多麻烦.见[[Wizard_Archive|Wizard Archive]]中的例子.
 
 
* If you have the problem when importing models that Vector3.up points in the wrong direction (or for any of the other directions), make the game model in question the child of a blank game object, and orient it correctly in local space.
 
* If you have the problem when importing models that Vector3.up points in the wrong direction (or for any of the other directions), make the game model in question the child of a blank game object, and orient it correctly in local space.
  如果你在导入模型时遇到Vector3.up值到错误方向(或其他方向)的问题,建一个空对象放入方向错误的模型,然后在模型的局部控制调整它的方位.
 
 
* When assigning properties of components in the Inspector, you can click on the triangle to pop up a menu of choices.  Type in the name of the thing you want and press enter to assign it.  This can be a speedy alternative to using drag-and-drop.
 
* When assigning properties of components in the Inspector, you can click on the triangle to pop up a menu of choices.  Type in the name of the thing you want and press enter to assign it.  This can be a speedy alternative to using drag-and-drop.
  当在Inspector中为组件指定属性时,可以点击右侧的小圆圈,弹出菜单进行选择.输入需要的物体名称然后回车.这样可以比拖放更快的替换.
 
 
* When entering text in the Inspector view, you can press option-return to get a new line.  This is useful for writing multiline things with GUIText objects.
 
* When entering text in the Inspector view, you can press option-return to get a new line.  This is useful for writing multiline things with GUIText objects.
  当在Inspector视图中输入文字时,可以按住option-return来获取一新行,对GUIText输入多行很有帮助.
 
 
* If you only have one editor view and no game views in the Unity pane set up, the editor view will be automatically replaced with a game view when  you enter play mode and back again when you press stop. This is a nice feature when you are working on a small monitor.
 
* If you only have one editor view and no game views in the Unity pane set up, the editor view will be automatically replaced with a game view when  you enter play mode and back again when you press stop. This is a nice feature when you are working on a small monitor.
  当在unity面板中仅有一个编辑器视图并没有游戏视图,当你进入播放模式时编辑器视图将自动替换为游戏视图而点击停止时又自动切回.当你在一个小显示器中工作时这是一个相对不错的特性.
 
 
* Use Tags to assign your own categories and attributes to game objects. Then scripts can refer to the tags. Example: '''if (contact.otherCollider.tag == "Enemy")''' or '''GameObject.FindWithTag ("Enemy")'''
 
* Use Tags to assign your own categories and attributes to game objects. Then scripts can refer to the tags. Example: '''if (contact.otherCollider.tag == "Enemy")''' or '''GameObject.FindWithTag ("Enemy")'''
  使用Tags类来为gameObject指定你自己的类型和属性.脚本可以引用到tags.如'''if (contact.otherCollider.tag == "Enemy")''' or '''GameObject.FindWithTag ("Enemy")'''
 
 
* If you want to move a file inside of a project use Unity's project view to move it and not the Finder. This way all references and import settings of the file will be maintained.
 
* If you want to move a file inside of a project use Unity's project view to move it and not the Finder. This way all references and import settings of the file will be maintained.
  如果你打算在一个项目中移动某文件使用Unity的Project视图来完成.unity将维护此文件的所有引用及导入设置.
 
 
'''Note: Place your new tip at the top of the list, not at the bottom.'''
 
'''Note: Place your new tip at the top of the list, not at the bottom.'''
'''注意: 将新的技巧放置到列表的顶部,而不是底部.'''
 

Revision as of 03:31, 1 January 2012

  • When move a GameObject, hold the Key v,will fast align.
  • A skinned character updates its vertices every frame, even when not animating. To freeze a skinned character in place without making it disappear or revert to a T-pose, set its SkinnedMeshRenderer.bones field to null.
  • There are two really nice hotkeys to insert or delete array elements in the inspector. SHIFT + DEL will delete the selected element and CTRL + D will duplicate it. SHIFT is only needed for reference types like GameObject[].
  • If you are dealing with deep hierarchies you can hold down the ALT button when toggling expansion of an item, to recursively toggle the tree.
  • When you're using Debug.Log or related methods, provide the instance of the script so you can click the log output and have the relevant object selected in editor! Debug.Log("Test", this);
  • If you're placing objects in the screen and want them to "snap" into place (great for placing items on the ground) you can hold the Command key (Control on Windows) while dragging the object's axis (snap increments are defined in Edit->Snap Settings)
  • Importing classes in JavaScript. Tired of writing Debug.Log and SendMessageOptions.DontRequireReceiver? Did you know that static members of classess and enums can be imported just like importing namespaces. Simply add import UnityEngine.Debug; and import UnityEngine.SendMessageOptions and then you can write Log("my log string") and SendMessage("ApplyDamage",2.0,DontRequireReceiver);.
  • Deleting objects. Use Command + Backspace in the Scene, Hierarchy and Project views to remove objects. In the Scene and Hierarchy views this will just remove the selected instance of the object. In the Project view this will remove the selected object file and put it in your system Trash.
  • If you need some textures, like font textures, to not be affected by Texture.masterTextureLimit, disable Generate Mip Maps in the texture's import settings. On the down side, this can adversely affect clarity of rendering at smaller scales.
  • Boo has some handy built-in functions like shell(), join() and reversed(). And the cool part? They are available from JavaScript as well.
  • Every built-in component in the inspector has a small question mark in the right of it's heading. That's the quickest way to open the context-help for that component. It's your friend.
  • To remember which color means what on an axis in Unity, just remember the mnemonic: RGB = XYZ.
  • You can use keyboard shortcuts for Edit->Load Selection and Edit->Save Selection to speed up the selection of commonly used parts in your scene.
  • If you option-click an object in your hierarchy, the entire hierarchy within it will expand and unexpand.
  • You can write Editor scripts to greatly reduce project-specific tedium when making something with Unity. These are just as easy to write as regular scripts, and can save you a lot of hassle. See the Wizard Archive for some examples.
  • If you have the problem when importing models that Vector3.up points in the wrong direction (or for any of the other directions), make the game model in question the child of a blank game object, and orient it correctly in local space.
  • When assigning properties of components in the Inspector, you can click on the triangle to pop up a menu of choices. Type in the name of the thing you want and press enter to assign it. This can be a speedy alternative to using drag-and-drop.
  • When entering text in the Inspector view, you can press option-return to get a new line. This is useful for writing multiline things with GUIText objects.
  • If you only have one editor view and no game views in the Unity pane set up, the editor view will be automatically replaced with a game view when you enter play mode and back again when you press stop. This is a nice feature when you are working on a small monitor.
  • Use Tags to assign your own categories and attributes to game objects. Then scripts can refer to the tags. Example: if (contact.otherCollider.tag == "Enemy") or GameObject.FindWithTag ("Enemy")
  • If you want to move a file inside of a project use Unity's project view to move it and not the Finder. This way all references and import settings of the file will be maintained.

Note: Place your new tip at the top of the list, not at the bottom.

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox