Introduction
3D characters have become an essential part of video games, movies, and other interactive media. They bring life to stories, provide a sense of immersion, and help users connect with the content.
Setting Up the Project
Before we dive into the process of creating 3D characters in Unity, let’s first set up the project. Follow these steps to create a new Unity project:
- Open Unity Hub (https://unity.com/products/unity-hub) and sign in.
- Click on “Create Project” and select “Blank Project.”
- Choose a location on your computer where you want to save the project.
- Name the project and select the template. For 3D character creation, we recommend using “2D Top-Down Game Template.”
- Click on “Create Project” and wait for the project to load.
Once you have created a new project, let’s import the assets we need to create our 3D characters. In this article, we will use a pre-made character model from TurboSquid (https://www.turbosquid.com/). Follow these steps to import the character model:
- Go to the “Assets” folder in your project and click on “Import Package.”
- Navigate to the location where you downloaded the character model from TurboSquid.
- Select the “Assets” folder and click on “Import Package.”
- Unity will import the character model into the “Assets/Import Packages” folder.
Texturing Our Character
Textureing is an essential part of creating realistic 3D characters. We will use a texture pack from Texture2D (https://texture2d.com/) for our character. Follow these steps to texture our character:
- In the “Assets” folder, click on the “Import Package” button again and select the texture pack from Texture2D.
- Unity will import the texture pack into the “Assets/Import Packages” folder.
- Select the character model in the “Hierarchy” window and go to the “Inspector” window.
- Under the “Materials” tab, click on the “+” button to create a new material.
- Name the material “Character Skin.”
- Drag and drop the texture file from the “Assets/Import Packages” folder onto the material in the “Inspector” window.
- In the “Inspector” window, adjust the settings as needed for the character skin material.
- Apply the material to the character model by selecting it in the “Hierarchy” window and going back to the “Inspector” window.
- Under the “Renderer” tab, select the character model and drag and drop the “Character Skin” material onto it.
Animating Our Character
Animation is what brings life to our 3D characters. In this article, we will use a pre-made animation from Anim2D (https://anim2d.com/). Follow these steps to animate our character:
- Go to the “Assets” folder and click on the “Import Package” button again.
- Select the animation pack from Anim2D and import it into the project.
- In the “Hierarchy” window, select the character model and go to the “Animator” tab in the “Inspector” window.
- Click on the “Create New Animator Controller” button in the “Controller” section of the “Animator” tab.
- Name the animator controller “Character Animations.”
- Drag and drop the animation files from the “Assets/Import Packages” folder onto the “Character Animations” animator controller in the “Inspector” window.
- Select the character model in the “Hierarchy” window and go back to the “Animator” tab in the “Inspector” window.
- In the “Animator Controller” section, click on the “+” button to create a new animation state.
- Name the animation state “Idle.”
- Drag and drop the first animation file from the animation pack into the “Idle” animation state.
- In the “Animator Controller” section, click on the “+” button again to create another animation state.
- Name the animation state “Walking.”
- Drag and drop the second animation file from the animation pack into the “Walking” animation state.
- Repeat steps 10-13 for any other animations you want to add to your character.
Adding Interactivity to Our Character
Interactivity is what makes our 3D characters feel real and engaging. We will use a script from Unity Asset Store (https://assetstore.unity.com/) for this purpose. Follow these steps to add interactivity to our character:
- Go to the “Assets” folder and click on the “Import Package” button again.
- Select the script pack from Unity Asset Store and import it into the project.
- In the “Hierarchy” window, select the character model and go to the “Component” tab in the “Inspector” window.
- Click on the “+” button to create a new script component.
- Drag and drop the script file from the “Assets/Scripts” folder onto the script component in the “Hierarchy” window.
- In the “Hierarchy” window, select the character model and go back to the “Component” tab in the “Inspector” window.
- Add any other necessary components such as Rigidbody, Collider, or Transform.
- Double-click on the script file in the “Project” window to open it in a code editor.
- In the script file, add the necessary code for interactivity. For example, you can use the following code to make the character walk when the player presses the “W” key:
- Save the script file and close the code editor.
- In the “Hierarchy” window, select the character model and go back to the “Inspector” window.
- Under the “Component” tab, drag and drop the script component onto the character model.
if (Input.GetKeyDown(KeyCode.W)) {
animator.SetInteger(“State”, 1); // 1 Walking animation state
}