Unity3d game development: unity3d Game Development

Source: Internet
Author: User

Unity3d game development: unity3d Game Development

The game engine must have been heard by everyone. For example, when you are drinking cola and staring at the computer screen, you can see that the role in the game scenario is under the control of your own keyboard and mouse, enjoying this kind of game operation, this kind of feeling is refreshing because it satisfies your own thinking (I can do what I want) and is slow. Today we will not talk about the game psychology, what we are talking about today is what makes us so attractive and fascinating? -- Game Engine
As we all know, the game engine is the core of the game performance just like the engine of a sports car. So far, some large game companies have developed or acquired their own game engines, for example, Unreal (Unreal), Blizzard's own Warcraft engine, and CryEngine, which is a conservative and controversial graphics card crisis (haha, It is the island crisis). Of course, different engines have different performance and image styles, for example, the realistic Unreal (left) and the cartoon pastoral Warcraft (right ).
OK, so today I will recommend the Unity3D game engine, a well-known game engine, as a Unity user and developer, I admire the outstanding performance and high cross-platform nature of the Unity3D engine. He integrates the MonoDeveloper compilation platform and uses C # and javascript as the main encoding languages, there seems to be another boo (the ghost knows this language). To implement mutual operations between classes in simple code, we use C # As the unified development language, in addition, Unity provides a good analysis tool for code running efficiency and resource overhead ()
For Scenario Editing and code writing, I will release it in my blog later. The following is an example. I believe you will be interested in it]
I wrote some code in Unity3D to listen to the mouse wheel event, and then the size of a square in the scenario also changed. Listing code: Move. cs
Using UnityEngine;
Using System. Collections;

Public class Move: MonoBehaviour {
Private float changSize = 0;

Void Update (){
ChangSize + = Input. GetAxis ("Mouse ScrollWheel ");
Transform. localScale = new Vector3 (1 + changSize, 1 + changSize, 1 + changSize );
}
}
The initial square size is (1, 1, 1 )()
Running result: we can see that the size of the square is adjusted to about 5 times by the pulley. below are resource consumption: I believe everyone has seen my Move. the Update () method accounts for about 10% of the total resources. This is not a small overhead. Our goal is to make Camera. render gets the largest proportion of resources so that the number of frames it renders reaches the maximum. therefore, we make an optimization and the code changes are as follows: 1 using UnityEngine;
2 using System. Collections;
3
4 public class Move: MonoBehaviour {
5 private float changSize = 0;
6
7 void Update (){
8 if (Input. GetAxis ("Mouse ScrollWheel ")! = 0)
9 {
10 changSize + = Input. GetAxis ("Mouse ScrollWheel ");
11 transform. localScale = new Vector3 (1 + changSize, 1 + changSize, 1 + changSize );
12}
13}
14}
OK. Let's take a look at the running results and resource consumption. The running resource consumption results are as follows: Move. update () has been controlled at around 1%, while Camera. render has also rebounded, indicating that our code has indeed played an unexpected optimization role in this running environment. The audience on the left, the audience on the right, and the audience on the front, do you feel the charm of Unity3D? The charm of Unity3D is more than just that. You will see more surprising content in the future, I hope you will like this exquisite and powerful game engine. from [DOG planing learning network]

Related Article

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.