Ceci est une ancienne révision du document !


GameObjects : Earth V 1.0

GameObjects are a very important concept in Unity. In Unity, everything that appears on the screen when your game is running comes from a GameObject: 3D objects, 2D sprites, the UI (User Interface), lights, cameras, C# scripts… Open the new empty project we created earlier. Unity created a default scene named “SampleScene.unity” and added just two GameObjects: a camera (named Main Camera) and a light (named Directional Light).

Creating Your First GameObject

To illustrate the concept of a GameObject, we’re going to create a 3D Earth. First, let’s find an Earth texture. In Google Images, type “earth texture” and download the texture you like best. Or download the one below

EARTH DAY MAP High Resolution 2K (2048×1024 pixels)

from the website https://www.solarsystemscope.com/textures There’s no need to use 4K textures or higher—this is a video game, so you always have to find the best balance between file size and quality.

In Unity, we’ll create a new “Textures” subfolder at the root of “Assets” (Create / Folder). Assets are all the source files for your game (3D models, textures, sounds, images, etc.).

From Windows File Explorer, copy and paste your ground texture into the “Textures” subfolder.

Now, go to the menu at the very top: GameObject / 3D Object / Sphere.

We create a sphere primitive directly in Unity. We have created a 3D sphere. The properties of the sphere GameObject appear in the panel on the right. Our GameObject is named “Sphere” and consists of 3 components.

The Different Components of the “Sphere” GameObject Components are building blocks that you can freely add to or remove from a GameObject.

A GameObject is essentially an empty container that always has a fixed “Transform” component to define its position, rotation, and size in space. After that, you’re free to add whatever components you want.

In our case, there are: – The “Sphere” component, which creates the 3D sphere object – The “Mesh Renderer” component, which renders the 3D object – The “Sphere Collider” component, which allows the 3D object to react to collisions

Modifying/Customizing Our GameObject

We’ll start by renaming our GameObject. It’s important to name things properly; otherwise, when your scene contains dozens of GameObjects, it will become unmanageable. Rename “Sphere” to “Earth.”

brasil/courses/blender_unity/unity/2_game_objects.1787079825.txt.gz · Dernière modification : de yann
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0