Unity game programmer face questions and Answers

Source: Internet
Author: User

Some typical examples, such as handwritten sorting algorithms and some basic mathematical problems, are not listed here. The following sorting out some representative, reference value questions, real interview questions, there can be no standard answer, or attached to my answer, welcome to discuss.

Question 1. Indicate which of the following are of value type?

int System.Object string unityengine.monobehaviour unityengine.object struct  enum  Vector3

Description: System.Object is the base class for all types and is itself a reference type. If you have any objection, you can leave a comment.

2. What are the commands for acquiring, adding, and deleting a build?

Get: getcomponent () added: addcomponent () Delete: removecomponent ()

3. Describe what third-party plugins you have used?

Skyshop do IBL and Pbr,shatter Toolkit do model physical fragmentation, Final IK plug-ins do inverse kinematics calculations.

Description: IBL is an image-based rendering, and PBR is a physical-based rendering. If you have additional comments , please leave a comment.

Topic 4. Briefly describe the principle of object pooling. What is the use of?

The object pool can store objects in a pre-drawn area of memory that can be taken out when needed, without having to instantiate new objects every time. This is typically used when you need to loop over an object but don't care about the creation time of the object.

Description: Object pooling is implemented in many language systems, and you can implement one yourself. So the answer does not have to be specific to a particular language, say its thoughts can.

Question 5: What are the pros and cons of using mipmap? What is the use of?

A: Using mipmap can reduce the existing bandwidth consumption, improve rendering performance, and reduce the distortion caused by the excessive reduction of textures in the distance due to the large resolution. The downside is that the memory footprint becomes larger, and in some cases, the distant map is blurred.

Description: Mipmap is a texture technology, in the three-dimensional world, showing the size of a picture and the location of the camera, near the place, the image of the actual pixel is larger, far place the actual pixels will be smaller, it is necessary to carry out some compression, such as a picture of 64*64, in the vicinity, it may be 50* 50, in the distance may be shown to be 20*20. If only the simple support of some pixels, will reduce the image loss of a lot of detail, the picture becomes very rough, therefore, graphics has a lot of complex ways to deal with the problem of reducing the picture, so that the picture is still clear.

Mipmap Texture technology is the most effective way to solve the relationship between texture resolution and viewpoint distance, it will first compress the picture into many shrinking pictures, such as a picture of 64*64, will produce 7 pictures of 64*64,32*32,16*16,8*8,4*4,2*2,1*1, When you need to draw a pixel to 20*20 on the screen, the program just uses 32*32 and 16*16 to calculate a picture that will be displayed as 20*20 size, which is much better and faster than the image computed from the original piece of 32*32 alone.

Of course you don't need to answer these principles and simply describe them.

Title 6. Describe the Drawcall merger in Unity3d.

A: Unity uses two methods for Drawcall merging: static and dynamic. The object system with the static option is forced to perform a static merge, and for non-static objects, the system automatically merges dynamically in the same material condition.

Description: Just like D3D's render (), unity is called a draw call each time it prepares data and notifies GPU rendering. Note that the subject is not for you to explain "drawcall" but to explain "Drawcall merger".

Topic 7. Brief introduction to the use of the Rand equation in game development α[m^2-m (T) ^2]=β[n^2-n (t) ^2] and α[m-m (t)]=β[n-n (t)]

A: In the formula of Alpha, β respectively, the warring parties in the unit time to kill each other fighting units, M (t), N (t) in the beginning of the battle after the two sides in the Battle of the surviving

Number of units of battle, assuming that the initial combat unit number of the two sides at the start of the engagement is M (0) =m,n (0) =n, the number of combat units in the fighting process conforms to the following state equations:

Α[m^2-m (t) ^2]=β[n^2-n (t) ^2]

Or

Α[m-m (t)]=β[n-n (t)].

Description: Basically answer the meaning on the line.

Title 8.

int New int [+]; foreach (int in a) {      foreach(int in a)      {            foreach(int in a)           {                0;           }}      }

What's wrong with the code snippets written in C # above?

A: First of all, in foreach, the temporary variable cc assignment itself syntax is wrong, the compiler does not pass the compilation. Second, this nesting of multiple uses of the Foreach loop is inappropriate, because the foreach statement produces a small amount of memory loss and is poorly performing.

Note: (1) to say a syntax error, (2) to say the foreach memory and performance loss, or to be inferior to a for statement.

Title 9.

  Class   dialog{}{ public  static   Gameobject M_NPC;  public  static  void   ShowDialog () {M_NPC  =object.instanciate (resource.load ( " NPC  " )   Gameobject);    SaySomething (M_NPC); }}  void static   saysomething (gameobject NPC) {...}   

It is assumed that the above classes written in C # have no syntax errors and can be used normally in the Unity3d engine. Q. What are the problems or pitfalls of this class?

A: The above dialog class in practice will be called multiple times, and each call to reload the same resources and instantiation, which is a loss of performance things.

Description: This problem according to the title description can be inferred from the actual project, then there must be a certain improper to take out the question. I only see these questions, if you have any good suggestions, you can leave a comment.

Title 10.

1  Public structFallcacheinfo2 {3      PublicTransform parent;4 }5 6  Public classLevelmanager7 {8 Transform Transform;9dictionary<int,fallcacheinfo> M_fallinfo =Newdictionary<int,fallcacheinfo>();Ten      One     voidFall (intID) A     { - Fallcacheinfo FCI; -Fci.parent =NULL; theM_fallinfo[id] =FCI; -  -Fci.parent = Gameobject.findchild ("POS"); -     } + } -  + voidOnwaitfallactorloaded (intID) A { at Fallcacheinfo FCI; -     if(M_fallinfo.trygetvalue (ID, outFCI)) -     { -Transform.parent =fci.parent; -     } -}

The above code, assuming that there is an object named "POS" in the scene, transform also for the existence of the object, fall and onwaitfallactorloaded functions are executed sequentially, ask transform finally to be hanging to which object (or node)?

A: It is eventually hung under the root node.

Description: Ask the reader to think.

Unity game programmer face questions and Answers

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.