Keywords: Unity, Basic Usage

Assets

Import

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

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

Address to Asset directory:

Prefab

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.

Reference:
https://docs.unity3d.com/Manual/InstantiatingPrefabs.html

Scene

Create Scene

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

Scene asset file:

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

GameObject

Script

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.

Programming

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?
A:

  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
https://docs.microsoft.com/en-us/visualstudio/cross-platform/using-visual-studio-tools-for-unity?view=vs-2019

Get started with Visual Studio Tools for Unity
https://docs.microsoft.com/en-us/visualstudio/cross-platform/getting-started-with-visual-studio-tools-for-unity?view=vs-2019

Tutorials

Youtube Tutorials

100 UNITY TIPS!!! 🔥
https://www.youtube.com/watch?v=thA3zv0IoUM


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