Keywords: Unity, Basic Usage



Q: How to open .unitypackage file?
A: Menu: Assets -> Import Package -> Custom Package.

Q: How to address to asset directory from selected object?
Address to Scene directory:

Address to Asset directory:


Q: How to create a cube prefab asset?
A: The example script above won’t work until you assign a Prefab to the Block variable. To create a simple block Prefab:

  1. Choose GameObject > 3D Object > Cube.
  2. Drag the cube from the Hierarchy window into the Assets folder in the Project window. This creates a Prefab Asset.
  3. Rename your Prefab to “Block”.
  4. Now that your Block Prefab exists as an Asset, you can safely delete the cube from your Hierarchy.



Create Scene

Q: How to create scene? A: Project Panel -> Create -> Scene.

Scene asset file:

Or: Right click in Project Panel -> Create -> Scene



Q:How to create GameObject?
A:Hierarchy Panel -> Creat -> Create Empty.

GameOjbect in scene:

Q:How to create C# script?
A:Project Panel -> Create -> C# Script.

C# Script file:

Q:How to attach script on GameObject?
A:Select GameObject in Hierarchy panel, then click Add Component -> Scripts -> Select C# script file.


Generate sln (Visual Studio) file

1, Edit -> Preferences -> External Tools -> External Script Editor -> Visual Studio.

2, Assets -> Open C# Project.

Debug in Visual Studio

Q:How to debug C# Script in Visual Studio?

  1. Install Visual Studio Tools for Unity: check Game development with Unity in installation detail window of Visual Studio.

    Microsoft Visual Studio Tools for Unity enabled would be shown in Unity Editor About panel when installation is finished.

  2. Edit -> Preferences -> External Tools -> Set External Script Editor as Visual Studio.

  3. Click Attach to Unity, then run game in editor, breakpoint would be trigger in Visual Studio.

    Or you can click Attach to Unity and Play, game would be run from Visual Studio.

Use Visual Studio Tools for Unity

Get started with Visual Studio Tools for Unity

No person deserves your tears, and who deserves them won't make you cry. ― Gabriel García Márquez