Android unity3d Basics

Source: Internet
Author: User

This is the second blog of Yuhua. Currently, it is still a cainiao. Recently I have been playing dispute 2. I think there was a great deal of emotion when I played ff8 in elementary school. Whenever the melody of eyes on me rings, my heart is full of memories. Maybe time has been passing, there will be more and more interesting games, and people will change slowly, but some things will never be replaced in your mind. Yu Hua is a loyal player. Playing Game Development is the first step to achieving your dream. I hope you will not forget your dream. I 've talked a lot about it. Now I start to get into the topic. This time, I am going to show you how to make a decent game in Android, and I'm still learning about it, I will share it with you after research. Currently, I can only share it with you.

 

Development Environment

Window 7

Unity3d 3.3.0

Mb525 defy Android 2.1-update1

 

This course:

1. Understand unity

2. unity3d environment construction and Android software generation

3. Basic unity3d usage

 

1. Understand unity3d

Unity3d is a game development tool that allows developers to create the same game on multiple platforms. It provides professional image processing and game engines to make a variety of games.

Yu Hua used to think that android game development could only work on code in eclipse. Maybe it was not enough experience. I don't know how much convenience the game engine can bring to game development, both 3D games and 2D games can be developed using unity3d and converted into iPhone games. Many mobile development functions of unity3d are shared by the iPhone and Android, and the most important controller is the same, in this way, we basically say goodbye to eclipse...

Since the scripts in unity3d are written in C # or Java Script, it is best to have learned these two languages. It doesn't matter. You can also learn them (like Yu Hua ), in fact, C # And JS are similar to Java and do not look so unfamiliar. Note that no matter what variable declarations in JS are represented by "Var, this is good for the appearance of declarations that often go wrong-0-

 

2. unity3d environment construction and Android software Generation Method

Here to introduce you to two websites, in which you can download to the latest UnitySetup-3.3.0 including crack patch u3v3.3.0f4 _ win and Script Editor unityscripteditor2.55, there are a lot of learning materials, this includes the unity video tutorial being learned by Yu Hua (all in English. =), There are all Chinese help documentation, although there is little information, but we can see that unity3d is getting more and more powerful...

 

Http://3d.ceeger.com/unity3d help documents

Http://www.u3dpro.com/unity3d Professional Forum

The installation process is not detailed. It is very simple. Note that the user name of the installed system should not be in Chinese. If you do not enable unity3d, nothing will be visible in the scene. This is a cutting-edge experience --.

1) After unity3d is opened for the first time, the Project Creation Interface will appear. This is the same as creating a project in eclipse. At this time, you can add some plug-in packages. This step will remain after the software is opened.

 

2) After the creation, the development interface is displayed. Here is a brief introduction:

Scene Development View: It can drag the object location, change the size, rotation angle, and so on, which is the most common place in development.

Game view: after the game is clicked, the game will run in the game view. When there is no point, you can see the current image of the camera.

The hierarchy layer tries to place game objects and observe the changes of Game objects during game operation.

Project project view: You can create folder management scripts, rendering, and images.

Inspector check view: displays object attributes, etc.

The bottom line does not show things normally. If an error occurs or a print statement is displayed below

Generate an Android software.

 

3) in the project, right-click --> Import package --> standard assets (mobile). This is a mobile development package. Import all the packages. In the project, select the imported standard assets (mobile) ---> Control setups --> camerarelativesetup. This will prompt you to save scene, and we will save one, we can see that there is another saved scene in the project, and the game is running starting from scene. At this time, we should be able to see the display of this package. At a glance, we can see that this is a demo controller package. At this time, we will not care about this working principle, first put it in the Android phone to see the effect.

 

4) Click the File menu in the upper left corner --> build settings --> select Android --> tick the development build on the right --> click the player settings below. Then, you can see some basic settings in the insperctor view, the first resolution and presentation is set for the game view. You can set the horizontal or vertical screen as you like. Click other settings. Here we mainly set the identification attribute. The first resolution is equivalent to the project package, this must not be the default value. You can write a name by yourself. For example, Yu Hua is com. lb. first, you can study other settings on your own. This step must be changed to generate this software.

 

5) then, return to the window and click build. The first point will jump out of a path for selecting the android SDK. Everyone knows where to choose, and then enter the name of an APK, it is called lb. If any error occurs, you can check the following prompt.

 

6) after the software has been generated, you can try to install it on your mobile phone. You can install it directly on the SD card. Here, Yu Hua will introduce a simple method, applicable to both simulators and real machines. First, set the environment variable and add D: \ Android-SDK-Windows \ platform-tools in the path, for example, to your own directory, in this way, you can run the command in the command console. For example, the installation command of Yu Hua is cd c: \ Users \ libei \ drivers \ LB, which is first in the APK directory, enter ADB install lb.apk. Note that if you have installed the software with the same name, uninstall the software before installing it.

 

7) in actual operation, the left joystick is the control displacement, and the right joystick is the control direction.

 

The steps seem quite simple.

 

3. Basic unity3d usage

We recommend that you watch the video here. You can learn the video quickly. Then, you can use the project option to open the example, select scene1 in scene and run it on your computer.

 

1) scenario Creation

All the data is built on cubes. You can see it at a Glance. You can create a cube in gameobject --> create other at the top, or click Create under hierarchy layer view, you can adjust the position by using the object option in the upper left corner of scene. The first is observation, the second is location adjustment, the third is angle adjustment, and the fourth is size adjustment.

2) Main View

Here, the main perspective is to use standard assets (which must be imported by yourself) --> character controllers --> first person controller. We can see that the objects that can be directly used here are actually prefab presets. Here you can see the sky. In fact, the skybox component is used. You can select main camera to component --> rendering --> skybox in the menu.

3) Light

If no light is running in the dark, a point light is put here, and the value can be adjusted on its own. The addition is the same as that of the cube.

4) script

The script is placed under the scripts folder. The door inside is the control door switch, the shoot is the mouse click event, and the respawn is the falling back to the original place. Note that after the script is written, it must be dragged to the corresponding object to run.

5) Animation

Opening the door is actually an animation created in component --> Miscellaneous --> Animation

6) Flame

The flame is generated by particles. The particle creation is similar to the cube. The numerical values in the particle system must be adjusted accordingly to produce the flame effect.

Next we will introduce several important components in component.

1) Rigidbody Rigid Body

As the name suggests, a rigid body has weight and collision attributes. If you add this component to an object, you need the attributes above.

2) character characters

In fact, all scripts are controlled from the perspective or operated by the main character.

3) trail Renderer path Renderer

It is a very useful component and you can see the path you have taken. The Forum uses it as an example of a fruit cutter.

 

Any new discoveries or works will be posted to the blog at the Yuhua summit. This basic unity3d study is here.

 

Code:

Http://download.csdn.net/source/3449798

 

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.