Introduction to unity 3D

Source: Internet
Author: User

Recently, I just started learning unity 3D. Here I will record my learning experience and study notes, and write while learning. It may be scattered. Now, let's talk a little bit about it. Today we will start from the introduction to unity 3D, which will briefly introduce unity 3D and some learning materials. Unless otherwise specified, unity 3D for Windows is used. The version is 4.5.1f3.

Unity 3D is a game development engine that currently supports development of 2D and 3D games. Its biggest advantage is its excellent cross-platform performance, it is easy to transplant PC-created games to Android, IOS, and other mobile platforms. Of course, you can also create web games. At the beginning of Unity 3D Game Development, go to the unity official website to download and install it. After installation, you can start to use unity 3D without the need to configure the environment and install other software. However, if you want to port the SDK to the Android platform, you also need to download the android SDK and other tools. It is similar to porting it to other platforms. You also need to download the corresponding software, but the configuration is very simple and there are many tutorials on the Internet, as an entry, you do not need to consider these issues. By default, you can generate (build) Win32 executable files.

After unity 3D is installed, development is divided into two parts: one is to edit Resources in the Unity 3D Editor (that is, click the main interface opened by unity 3d, the other part is to use scripts to control these resources and let them execute corresponding behaviors.

1. Game objects and components)

There is a lot of information on the Internet about the unity 3D editor. This section describes the main framework of game development.

Unity 3D regards all the resources required in the game as the object (gameobject). For example, a city scene in the game is an object, which includes roads, street lights, and houses, these are all objects. Generally, objects such as road surface and street lamp are used as sub-objects in urban scenarios. This ensures that the relative positions of sub-objects and parent objects remain unchanged throughout the game scenario and move parent objects, the child object will also move.

Each object contains various components, such as what the object looks like (appearance), where it is placed, and whether it can make a sound, it is determined by the components attached to the object. Each object can select its own components. These components determine the attributes of the object. Note that each object must contain a transform component, which determines the position, rotation, and size of the object. So why must this component be included? Imagine how an object exists in a scene without this component?

As you can see from the menu, unity has a lot of built-in game objects (gameobject). The first option "create empty" is to create an empty object that contains only the objects of the transform component, the game objects in the "create other" menu are all built-in game objects. These built-in game objects are actually composed of components added to an empty object by unity 3D. This means that by default, all the objects provided by unity 3D can be created by creating an empty object and then adding various components. However, unity 3D helps you with this work, saving you some trouble, provides some frequently used game objects. It can be seen from this that components are the core of Unity 3D, and the learning of various components of Unity 3D is inevitable in the future. For various components, you can learn more about them in the future. Here, you can leave an impression on the overall structure.

  

2. Script

After adding game objects, you need to use scripts to control these game objects.

For example, when a person wants to move around in the city, he must first construct the city objects and people. Here, people can be made by other modeling tools (such as 3DS MAX and Maya). The model can contain human animations and detailed human structures: Hands, noses, etc, the created model is saved in fbx format and can be imported directly to unity 3D. After the above object is constructed, I want to control the walk by WASD, which requires some scripts to control. Unity 3D supports scripts in three languages: C #, JavaScript, and Boo. C # is used for example and explanation.

Unity 3D will automatically install monodevelop during installation. This is a code editor (used for writing code and with an automatic prompt). By default, unity 3D uses it as the code editor, you can read and edit the code. If you are not used to it, you can install vs. By setting it, you can use the editor provided by Vs to edit the code. This setting is not described here. Visual assist can be used to highlight and complete codes. However, monodevelop's code auto-completion function is also available, but there is a problem: If a variable hits half of the total number, it is wrong, delete a few letters, and then the variable's code completion will disappear, the Automatic completion prompt is provided only after the script is written from the beginning, and the fuzzy matching of the Code Completion is not as easy as the VC assistant. However, in general, monodevelop is still good. If you are not used to its default code style, you can set it, as shown in.

In tool-options, you can also modify the font. I prefer to use the consolas. The font size is casual, because in the editor, press Ctrl + the scroll wheel to zoom in and out the whole. Also, we recommend that you check insert matching brace and smart simicolon placement in tool-options-Text Editor-behavior so that the brackets (http://www.liketocode.com/coding/185.htm) can be automatically filled. Here, I would like to thank this elder brother for sharing, finally, I found the setting for automatic matching of parentheses.

The first article is written here first. If there is an error, you are welcome to correct it.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.