This action will create a C# file under /Assets/Player.cs that defines a component named “Player”, and then it will add this Component to the Player Game Object. Note: checkout Unity’s Manual section “Creating components with scripting” for more info. Then, write in the search input Player, select New Script, and press the “Create and Add” button. Select the Player Game Object and press the “Add Component” button in the Inspector window. We will do it by creating a Custom Component containing C# code and adding it to the Player Game Object. To move our Player, we will need to add some logic to its dumb Game Object. This time we will learn to move 2D Object in Unity by scripting in C# using Game Components. It’s time to give them some movement logic starting by the Player. In the previous tutorial, "Getting Started in Unity 2D Game Development", we walk through basic concepts about developing 2D games in Unity, ending up with a scene with some still Game Objects. ![]() ![]()
0 Comments
Leave a Reply. |