unity 添加c#脚本
Of course, having objects that don't move in our game doesn't really make our game interesting. So, let's understand how Unity C# Script can be used to move the game objects, and from there on we'll move to Rigidbodies.
当然,拥有无法在我们的游戏中移动的对象并不会真正使我们的游戏变得有趣。 因此,让我们了解如何使用Unity C#脚本移动游戏对象,然后从那里移至“刚体”。
First, of all, let's create a script. To do so, right click in the Assets area, and go to Create → C# Script.
首先,让我们创建一个脚本。 为此, 右键单击 Assets区域,然后转到Create→C#Script 。
This will create a new file, with the default name NewBehaviourScript. Rename the script to Movement, and press Enter. This will create a new script with name Movement in the Assets section. Double click on it to open it, and let's see what happens. Don't type anything in this script for now.
这将创建一个默认名称为NewBehaviourScript的新文件。 将脚本重命名为