Unity comprehensive interview questions (including answers) and unity interview questions

Source: Internet
Author: User

Unity comprehensive interview questions (including answers) and unity interview questions

1. What is a collaborative program?

Enable another logic processing when the main thread runs to assist in the execution of the current program. The coroutine is like multithreading, but not multithreading, the Unity coroutine checks whether the yield conditions are met after each frame ends.

Ii. What is the difference between the collision generator and the trigger in Unity3D?

The collision generator is the trigger carrier, and the trigger is only an attribute of the collision generator. When Is Trigger = false, the collision operator triggers a collision based on the physical engine, resulting in a collision effect. You can call the OnCollisionEnter/Stay/Exit function; when Is Trigger = true, the collision server is ignored by the physical engine and has no collision effect. You can call the OnTriggerEnter/Stay/Exit function. If you want to detect the contact of an object and do not want the collision detection to affect the movement of the object or check whether an object has passed through a certain area of space, you can use a trigger.

3. What are the necessary conditions for collision?

Both objects must carry a Collider. One of the objects must also carry a Rigidbody rigid body, and the moving object must carry a Rigidbody script to detect the collision.

4. What are the main differences between ArrayList and List?

The ArrayList has an insecure type (ArrayList treats all the data inserted into it as objects). The packing and unpacking operation (time-consuming) List is an interface, arrayList is a class that implements this interface and can be instantiated.

5. How to securely migrate asset data between different projects? Three methods

1. migrate the Assets Directory and the Library directory together

2. export Package, export Package

3. Use the assets Server feature provided by unity

6. What is the sequence of OnEnable, Awake, and Start running? Which may occur repeatedly in the same object cycle?

Awake-> OnEnable-> Start, OnEnable can occur repeatedly in the same cycle.

7. What is the difference between material and sharedmaterial in MeshRender?

Modifying sharedMaterial will change the appearance of all objects using this material, and also change the material settings stored in the project. It is not recommended to modify the material returned by sharedMaterial. If you want to modify the Renderer material, use material instead.

8. What are several types of light sources provided by Unity?

Four.

Parallel Light: Directional Light

Point Light Source: Point Light

Spotlight: Spot Light

Area Light Source: Area Light

9: Briefly describe the object pool. What do you think is suitable for using the object pool in FPS?

The object pool stores a space for resources that need to be repeatedly called. It takes a lot of time to destroy and create an object when it is generated, put unused objects in a pool (that is, a set) through the object pool. When this object is re-generated for the moment, first check whether there are available objects in the pool, if yes, you can use it directly without creating any more. If no available objects exist in the pool, you need to create a new one. You can use the space for time to achieve the high-speed running effect of the game, in FPS games, objects that are frequently copied include bullets, enemies, and particles.

10. Differences between CharacterController and Rigidbody

Rigidbody has completely physical characteristics. The most basic component of the physical system in Unity contains common physical characteristics. CharacterController can be said to be a restricted Rigidbody, it has certain physical effects but is not completely authentic. It is a component encapsulated by Unity to enable developers to easily develop a first-person game.

11: Briefly describe the use of prefab

During Game runtime instantiation, prefab is equivalent to a template that makes a default configuration for your existing materials, scripts, and parameters for later modification, at the same time, the content packaged by prefab simplifies the export operation and facilitates communication between teams.

12: Briefly describe the role of the sealed keyword in class declaration and function declaration.

The class modified by sealed is a sealed class, which prevents other classes from inheriting this class when declared, and declares in the method to prevent the derived class from rewriting this method.

Thirteen: Briefly describe the differences between private, public, protected, and internal.

Public: public to all classes and members, unrestricted access

Private: Only public for this class

Protected: public for this class and its derived class

Internal: You can only access this class in a set of programs that contain this class.

14: How many methods can I use unity3d to implement 2d games?

2. Adjust the Projection value of the camera to Orthographic without considering the Z axis;

3. Use 2d plug-ins, such as: 2 DToolKit, and NGUI

15th: during the entire collision process of an object, there are several stages to list the corresponding functions respectively.

Three phases: 1. OnCollisionEnter 2. OnCollisionStay 3. OnCollisionExit

16th: In the Unity3d physical engine, there are several ways to apply force, which are described separately

Rigidbody. AddForce/AddForceAtPosition are all in the rigidbody series functions. You can view the rigidbody API by yourself.

17: What is chain joint?

Hinge Joint can be used to simulate the connection between two objects with a chain, so that the two objects can move each other within a fixed distance without generating force, however, after reaching a fixed distance, tension will occur.

18: functions used for self-rotation of objects?

Transform. Rotate ()

19: Unity3d provides a class for saving and reading data (PlayerPrefs). List the functions for saving and reading integer data.

PlayerPrefs. SetInt () PlayerPrefs. GetInt ()

20: The Unity3d script has a complete life cycle from wake-up to destruction. Please list several important methods that come with the system.

Awake --> OnEnable-> Start --> Update --> FixedUpdate --> LateUpdate --> OnGUI --> OnDisable --> OnDestroy

21: Which system function is physical update generally stored in?

FixedUpdate, which can be executed at a fixed interval. You can set update in edit-> project setting-> time to be executed in the rendering frame. Unlike Update, FixedUpdate is executed in the rendering frame, if your rendering efficiency is low, the number of FixedUpdate calls will decrease. FixedUpdate is more suitable for computing on the physical engine because it is related to the rendering of each frame. Update is more suitable for control.

22: What happens when multiple Camera servers are put in the active state at the same time in the scenario?

The game interface shows a mix of many cameras.

23: how to destroy an UnityEngine. Object and its subclass?

Use the Destroy () method;

Twenty-four: Describe why data loss occurs on the component in Unity3d.

Generally, the object bound to the component is deleted.

25th: what is the level of detail (paid)? What are the advantages and disadvantages?

Level of detail is the most common game optimization technology. It determines the resource allocation of object Rendering Based on the location and importance of the model, reduces the number of faces and details of non-important objects, and achieves efficient rendering operations. The disadvantage is that the memory is increased.

26: What is MipMap and its role?

MipMapping: a commonly used technology in 3D computer graphics Paster rendering. To speed up rendering progress and reduce image aliasing, textures are processed into files composed of a series of pre-computed and Optimized images. Such textures are called MipMap.

Twenty-seven: Describe the differences between interfaces and abstract classes.

Abstract class indicates that some methods may have been defined in this class, but the interface is public and can only define the interface of each method, not the specific implementation code in the member method. Classes are inherited by subclasses. When the parent class already has methods with actual functions, this method can be implemented in the subclass without directly referencing the methods of the parent class, subclass can also override the method of the parent class. When implementing an interface, you must implement all the methods in the interface, and do not omit any one.

Twenty-eight: What is the relationship between. Net and Mono?

Mono is an open-source cross-platform tool of. net. Similar to java virtual machine, java itself is not a cross-platform language, but runs on a virtual machine to implement cross-platform .. Net can only run in windows, mono can run across platforms, Linux, Unix, Mac OS, and so on.

29th: Briefly describe the names of languages supported by Unity3D as scripts.

The Unity script language runs on Mono's. Net platform and can use the. NET library. This provides a good solution for XML, database, regular expressions, and other issues. All scripts in Unity are compiled, and their running speed is also fast. The functions and running speed of these three languages are the same. The differences are mainly reflected in the language features. JavaScript, C #, Boo

Thirty: component name in U3D used to record the geometric information of the node space and its parent class name

The parent class of Transform is Component.

: What is the significance of dot multiplication, cross multiplication, and normalization of vectors?

1. Point multiplication describes the similarity between two vectors. The larger the result, the more similar the two vectors are.

2. The cross-multiplication vector is perpendicular to the original two vectors.

3. Standardization vector: used when only the link direction is concerned with the size

: Why do everyone seek a U3D native GUI alternative on mobile devices

The OnGUI is time-consuming, inefficient, and inconvenient to use.

33: briefly describe how to maintain UI consistency at different resolutions

NGUI solves this problem well. The screen resolution is adaptive. The principle is to calculate the screen width to height ratio and obtain a comparison value from the preset screen resolution, and then modify the camera size. UGUI solves this problem through the anchor point and resolution.

34: What is LightMap?

LightMap: it refers to the realization of light in the 3D software, and then the rendering of the scene surface light output to the texture, and finally through the engine to the scene, in this way, the object will feel the light.

35: differences between Unity and cocos2d

36: What is the difference between C # And C ++?

To put it simply, the most important feature of C # compared with C ++ is that C # is a completely object-oriented language, while C ++ is not, in addition, C # is based on the IL intermediate language and. NET Framework CLR, In the portability, maintainability and robustness are greatly improved compared with C ++. C # is designed to develop fast, stable, and scalable applications. Of course, you can also perform some underlying operations through Interop and Pinvoke. For more detailed differences, refer to here

37: What is the difference between struct and class?

Struct is a value type, and a class is a reference type. (The Value Type and reference type are based on the data storage perspective) is the value type used to store data values, and the reference type is used to store references to actual data. The struct is used as a value, and the class operates on the actual data through reference.

38: What are the ref and out parameters? What is the difference?

The effect of the ref parameter is the same as that of the out parameter. The memory address of the variable defined in the main function is found through the keyword, and its size is changed through the syntax in the method body. The difference is that the output parameter must be initialized. Ref must be initialized, And the out parameter must be assigned a value in the function. The ref parameter is a reference and the out parameter is an output parameter.

39: What is the C # Delegate? What is the purpose?

A delegate is similar to a safe pointer reference. When using it, it is treated as a class rather than a method, which is equivalent to referencing a list of methods. Use: Enable the programmer to encapsulate the method reference in the delegate object. The delegate object can then be passed to the code that can call the referenced method, without knowing which method will be called during compilation. Unlike function pointers in C or C ++, delegation is object-oriented and type-safe.

In forty: C #, what are the sorting methods?

Select sorting, Bubble sorting, fast sorting, insert sorting, Hill sorting, and Merge Sorting

Forty-one: what is the principle of Ray-based collision detection?

A ray is a line in the 3D world that emits a point in one direction without an end point. When it collides with other objects in the emission track, it stops launching.

: What is the role of Clipping Planes in Unity? What should I pay attention to when adjusting the Near and Fare values?

Crop a plane. The distance from the camera to start rendering and stop rendering.

Forty-three: how to prevent the existing GameObject from being detached after LoadLevel?

Void Awake () {DontDestroyOnLoad (transform. gameObject );}
Forty-four: Briefly describe the cause of GC (garbage collection) and describe how to avoid it?

GC reclaim memory on the heap

Avoid: 1. Reduce the number of new generation objects

2. Use public objects (static members)

3. Replace String with StringBuilder

45: How does reflection work?

Ability to review metadata and collect information about its type. Implementation principle: Get metadata at runtime Based on the Assembly and its types. The following are the implementation steps:

Foreach (Type type in assembly. GetTypes () {string t = type. Name ;}
4. Type type = assembly. GetType ("assembly. Class Name"); get the Type of the current class

Forty-six: Briefly describe the role of the Quaternary element. What are the advantages of the Quaternary element on the Euclidean angle?

Used to indicate Rotation

Advantages compared with orah:

1. incremental Rotation

2. Avoid universal lock

3. There are two expressions for the given orientation, which are negative to each other (whether there are several expressions in orah)

Forty-seven: In which function is the Mobile Camera Action? Why is it in this function?

LateUpdate is called only after all updates are completed. It is suitable for Executing command scripts. In the example on the official website, the camera follows up after all update operations are completed. Otherwise, the camera may have been pushed forward, however, there is no empty frame for the role in the perspective.

Forty-eight: How GPU works

In short, the GPU graphics (processing) pipeline completes the following tasks: (not necessarily in the following order)Vertex Processing: In this phase, the GPU reads vertex data describing the appearance of a 3D image, determines the shape and position of the 3D image based on the vertex data, and establishes the skeleton of the 3D image. In GPUs supporting DX8 and DX9 specifications, these tasks are completed by the hardware-implemented Vertex Shader (fixed-point Shader.Raster computing: The actual display of the image is composed of pixels. We need to convert the points and lines on the image generated above to the corresponding pixel through a certain algorithm. The process of converting a vector image into a series of pixels is called grating. For example, a mathematical diagonal line segment is eventually converted into a tiered continuous pixel.Texture posts: The polygon generated by the vertex unit only forms the contour of a 3D object, while the texture mapping (texture mapping) completes the post graph of the Multi-deformation surface, it is to paste the corresponding image on the surface of the polygon to generate a "real" image. TMU (Texture mapping unit) is used to complete this task.Pixel Processing: In this phase (during raster processing of each pixel), the GPU completes pixel computing and processing to determine the final attribute of each pixel. In GPUs that support DX8 and DX9 specifications, these tasks are completed by the hardware-implemented Pixel Shader.Final output: The drop (raster engine) completes pixel output. After one frame is rendered, it is sent to the buffer zone of the video storage frame.

Summary: In general, GPU is used to generate a 3D image, map the image to the corresponding pixel, calculate each pixel, determine the final color, and complete the output.

Forty-nine: What is a rendering pipeline?

It refers to a series of necessary operations on the monitor to display the image. Many steps in the rendering pipeline are to change a geometric object from one coordinate system to another. The main steps are as follows:

Local coordinates-> View coordinates-> back cropping-> illumination-> cropping-> projection-> View transformation-> Rasterization

50: how to optimize the memory?

There are many ways, such

1. Compress built-in class libraries;

2. Hide the objects that need to be used for the moment instead of directly Destroy them;

3. release resources occupied by AssetBundle;

4. Reduce the one-sided quantity of the model, reduce the number of bones of the model, and reduce the texture size;

5. Use the lightmap, multi-level details (looss), Shader, and Prefab ).

6. generate less temporary variables in the code

: How does one dynamically load resources? Differences between them

1. Resources. Load ();

2. AssetBundle

Differences

: Which types of game animations are described and their principles?

It mainly includes joint animation, bone animation, and single Grid Model Animation (Key Frame Animation ).

Joint Animation: divide a role into several independent parts. One part corresponds to a grid model, and the animation of some parts is connected to an overall animation. The role is flexible and this animation is used in Quake2;

Bone animation, a widely used animation method, integrates the advantages of the above two methods. The skeleton forms a certain level of structure based on the characteristics of the role and has joint links for relative motion, the skin is placed out of the skeleton as a single grid and determines the role's appearance;

A single mesh model animation consists of a complete mesh model. It records the original position of each vertex and the amount of changes in the key frames of the animation sequence, and then interpolation is performed to achieve the animation effect, role animation is more realistic.

Fifty-three: How alpha blend works

Alpha Blend achieves transparency, but only alpha operations can be performed on a certain region. transparency can be set.

Fifty-four: Write the diffuse formula in illumination Calculation

Diffuse = Kd x colorLight x max (N * L, 0 ); kd diffuse reflection coefficient, colorLight color, N unit normal vector, L point to the unit vector of the light source, where N and L point multiplication, if the result is less than or equal to 0, the diffuse reflection is 0.

Fifty-five: two shadow judgment methods and working principles.

Local and semi-shadows: see local and semi-shadows.

Local shadows: areas on the surface of a scene that are not directly illuminated by a light source (all black areas with clear contours ).

Shadow: areas on the surface of a scene that are directly exposed to certain light sources but not directly exposed to all specific light sources (half-bright and half-dark areas)

Working principle: from the light source to all the visible light of the object, projection these planes into the scene to get the projection surface, and then the projection surface and other planes in the scene to obtain the shadow polygon, save the shadow polygon information, and then process the scene according to the viewpoint position to obtain the required view. (by changing the space for time, you only need to perform a shadow calculation based on the viewpoint position each time, saves a invisibility process)

Fifty-six: What is Vertex Shader and how to calculate it?

The Vertex Shader is a program executed on the GPU to replace transformation and lighting in the fixed pipeline.

Vertex Shader completes the transformation from local space to homogeneous space (homogeneous space) for the input Vertex. homogeneous space is the next space of the project space. There are several processes, including world transformation, view transformation, projection transformation, and lighting.

57: How many temporary objects will the following code generate during running?

String a = new string ("abc"); a = (a. ToUpper () + "123"). Substring (0, 2 );
The first line in C # will report an error (which is feasible in Java ).

Initialization should be like this:

String B = new string (new char [] {'A', 'B', 'C '});
The answer is: 5 temporary objects

Fifty-eight: what will happen to the following code during running? How to avoid it?

List ls = new List (new int [] {1, 2, 3, 4, 5}); foreach (int item in ls) {Console. writeLine (item * item); ls. remove (item );}
An error occurs during running. In the line ls. Remove (item), because foreach is read-only. It cannot be modified while traversing.

Fifty-nine: Does Unity3D support multi-threaded programming? What should I pay attention to if it is supported?

Only Unity3D components can be accessed from the main thread, and objects and Unity3D system calls

Yes: If you want to deal with many things at the same time or interact with Unity objects, you can use thread; otherwise, coroutine is used.

Note: C # has the lock keyword to ensure that only one thread can access a specific object within a specified period of time.

60: What is the difference between the Unity3D coroutine and the C # thread?

A multi-threaded program runs multiple threads at the same time, while only one coroutine is running at any specified time, and the running collaborative program is suspended only when necessary. Threads other than the main thread cannot access Unity3D objects, components, and methods.

Unity3d does not have the concept of multithreading, but unity also provides us with StartCoroutine and LoadLevelAsync background loading scenarios. Why is StartCoroutine a collaborative program? The so-called collaboration means that when you process a piece of code in the StartCoroutine function body, you can use the yield statement to wait for the execution result, this period does not affect the continued execution of the main program, and can work together.

Sixty-one: Significance and attention of Matrix Multiplication

Used to represent linear transformation: rotation, scaling, projection, translation, and affine

Note matrix creep: Error Accumulation

: Why is dynamic font better than static font in unicode environment?

Unicode is a character encoding scheme developed by international organizations to accommodate all texts and symbols in the world.

When dynamic fonts are used, Unity will not generate a character texture with all fonts in advance. If normal textures are used to support Asian languages or Large fonts, the font textures are very large.

Sixty-three: What happens when a small high-speed object hits another large object? How to avoid it?

Penetration (Collision Detection failed)

Sixty-four: Could you briefly describe the occurrence time of OnBecameVisible and OnBecameInvisible, and the significance of this pair of callback functions?

When the object is visible and switched. It can be used for computing only when the object is visible.

65: What is dynamic joint approval? What is the difference with static batch combination?

If dynamic objects share the same material, Unity will automatically batch process these objects. Dynamic batch processing is automatically completed without additional operations.

Difference: Dynamic batch processing is automatic without any operation, and objects can be moved, but there are many restrictions. Static batch processing: it has a high degree of freedom and few restrictions. Its disadvantages may occupy more memory, and all objects after static batch processing cannot be moved.

Reference

16th: What is the difference between StringBuilder and String?

String is a String constant.

StringBuffer is a string variable and thread security.

StringBuilder is a string variable and the thread is not secure.

The String type is an unchangeable object. Every time you change the String type, you need to generate a new String object and point the pointer to a new object. If it is in a loop, continuously changing an object requires constant generation of new objects, so the efficiency is very low. We recommend that you do not use the String type where you constantly change the String object.

The StringBuilder object is modified on the original string during the string connection operation, improving the performance. We usually know that StringBuilder objects are used when connection operations are frequent.

17th: What are the differences between Unity3D Shader and Unity3D Shader?

The abstract level of the surface coloring tool is relatively high. It can easily implement complex coloring in a concise manner. The surface paintors work normally in both forward rendering and delayed rendering modes.

The vertex fragment shader can achieve the desired results flexibly, but requires more code and is difficult to integrate perfectly with the rendering pipeline of Unity.

The fixed-function pipeline Shader can be used as an alternative for the first two pasters. When the hardware cannot run those cool Shader, you can also use the fixed function pipeline coloring tool to draw some basic content.

Sixty-eight: the prototype of the known strcpy function is char * strcpy (char * strDest, const char * strSrc); 1. Implement the strcpy function without calling the library function. 2. Explain why char * is returned *

Char * strcpy (char * strDest, const char * strSrc)
{
If (strDest = NULL) | (strSrc = NULL ))
Throw "Invalid argument (s )";
Char * strDestCopy = strDest;
While (* strDest ++ = * strSrc ++ )! = '\ 0 ');
Return strDestCopy;
}
Sixty-nine: C # What are the four access modifiers? What are their differences?

1. Attribute modifier 2. access modifier 3. Class modifier 4. Member modifier.

Property modifier:

Serializable: blocks objects to a remote server by value.

STATread: indicates a single-threaded suite. It is a thread model.

MATAThread: it refers to a multi-threaded suite and is also a thread model.

Access modifier:

Public: Access is unrestricted.

Private: only the class containing this member can be accessed.

Internal: only the current project can be accessed.

Protected: only classes containing this member and derived classes can be accessed.

Class modifier:

Abstract: abstract class. Indicates that a class can only be used as the base class of other classes.

Sealed: sealed class. Indicates that a class cannot be inherited. Naturally, the sealed class cannot be an abstract class at the same time, because the abstract always wants to be inherited.

Member modifier:

Abstract: indicates that this method or attribute is not implemented.

Sealed: sealed method. This prevents override (overload) of the method in the derived class ). Not every member method of the class can be used as a sealing method. The virtual method of the base class must be overloaded to provide specific implementation methods. Therefore, in method declaration, the sealed modifier is always used together with the override modifier.

Delegate: delegate. Defines a function pointer. The event driver in C # is based on delegate + event.

Const: the value of the specified member cannot be modified only.

Event: declare an event.

Extern: indicates that the method is implemented externally.

Override: rewrite. The new implementation of the inherited members of the base class.

Readonly: indicates that a domain can only be assigned values when declared and inside the same class.

Static: indicates that a member belongs to the type rather than a specific object. That is, it can be used after definition without being instantiated.

Virtual: indicates that the implementation of a method or accessor can be overwritten in the inheritance class.

New: hides the specified base class member in the derived class to implement the rewrite function. To hide a member of an inherited class, declare the member with the same name in the derived class and modify it with the new modifier.

70: What is the difference between Heap and Stack?

1. heap is a stack, and stack is a stack.

2. stack space is automatically allocated and released by the operating system. heap space is manually applied for and released. heap is usually allocated with the new keyword.

3. The stack space is limited, and the heap space is a large free zone.

: What is the difference between the value type and the reference type?

1. Value-type data is stored in the memory stack; reference-type data is stored in the memory heap, while memory units only store the address of objects in the heap.

2. Fast value-type access and slow reference-type access.

3. The value type indicates the actual data, and the reference type indicates the pointer or reference to the data stored in the memory heap.

4. The value type inherits from System. ValueType, and the reference type inherits from System. Object.

5. The stack memory allocation is automatically released, and the stack will be released by GC in. NET.

6. variables of the value type directly store the actual data, while variables of the reference type store the data address, that is, object reference.

: Write out the algorithms worth finding any digit in the Fibonacci series.

Recursive Implementation:

Int Fib1 (int index)
{
If (index <1)
{
Return-1;
}
If (index = 1 | index = 2)
{
Return 1;
}
Return fiber 1 (index-1) + fiber 1 (index-2 );
}
Iterative implementation:

Int Fib5 (int index)
{
If (index <1)
{
Return-1;
}
Int a1-1, a2 = 1, a3 = 1;
For (int I = 0; I <index-2; I ++)
{
A3 = a1 + a2;
A1 = a2;
A2 = a3;
}
Return a3;
}

73: What is the code executed by the coprocessor? What are their usefulness and disadvantages?

Function Start (){
// The Coordinator WaitAndPrint is executed in the Start function, which can be regarded as synchronous execution with the Start function.
StartCoroutine (WaitAndPrint (2.0 ));
Print ("Before WaitAndPrint Finishes" + Time. time );
}
Function WaitAndPrint (waitTime: float ){
// Pause waitTime seconds
Yield WaitForSeconds (waitTime );
Print ("WaitAndPrint" + Time. time );
}

Purpose: a collaborative program can use the yield statement anywhere during execution. The return value of yield controls when the synergy program is resumed for downward execution. The collaboration program is excellent in the execution process of the object's own frames. There is no more performance overhead for the coprocessor.

Disadvantage: the coprocessor is not a real thread and may be congested.

: What is the Li's token exchange?

Liskov Substitution Principle LSP is one of the basic principles of object-oriented design. Common point: a subclass object can be assigned to a base class object. A base class object cannot be assigned to a subclass object.

Reference

75: What is the difference between Mock and Stub?

The difference between Mock and Stub: Mock: Focus on behavior verification. Fine-grained testing, that is, code logic, is usually used for unit testing. Stub: Follow status verification. Coarse-grained testing is used when a dependent system does not exist or has not been implemented or is difficult to test, such as accessing the file system, database connection, and remote protocols.

16th: Overview serialization:

Serialization is simply a process of converting an object into a format that is easy to transmit. For example, you can serialize an object and Use HTTP to transmit the object between the client and the server over the Internet.

17th: What is the difference between stack and stack?

The stack usually stores the steps for executing our code, such as the AddFive () method, int pValue variable, int result variable, and so on in code segment 1. Objects and data are mostly stored on the stack. We can think of a stack as a box stacked together. When we use it, each time we take a box from the top. The same is true for stacks. When a method (or type) is called, it is removed from the top of the stack and followed by the next one. The heap is not a repository. It stores the various objects we use and other information. Different from the stack, they are not cleared immediately after being called.

Seventy-eight: Overview c # What are the processes and events?

A proxy is used to define reference to a method.

C # an event is essentially a message encapsulation used for communication between objects. A sender is an event sender and a receiver is an event receiver.

: How many ways does the client interact with the server?

Socket is also known as "socket". It implements physical connections between the server and the client and transmits data. It mainly includes UDP and TCP Protocols. The Socket is in the transmission layer of the network protocol.

Http transmission mainly involves http protocol and http-based Soap protocol (web service). The common methods are http post AND get requests and web services.

80: How does Unity interact with Android and iOS?

Unity can send messages to Unity through Android or iOS classes and call the methods in Unity

October 11: How can I view the interview, vertex count, and Draw Call count in Unity3D? How to reduce the number of Draw calls?

Click Stats in the upper-right corner of the Game view. Draw Call Batching

The shortcut key is cmd + 7 (ctl + 7) under window-"Profiler after 5.0.

12th: When will alpha test be used? What results can be achieved?

Alpha Test: transparency Test in Chinese. In short, the alpha value of the point color value output by the last fragment function in V & F shader (that is, the output half4 of frag in the previous section) is compared with the fixed value. The AlphaTest statement is usually the starting position in Pass. The results produced by Alpha Test are extremely extreme, either completely transparent, that is, invisible, or completely opaque.

October 13: UNITY3d methods for optimizing resources on mobile devices

1. Use assetbundle to implement resource separation and sharing, control the memory to within MB, and online resource update.

2. The number of vertices is the biggest contributor to rendering both the cpu and gpu. The number of vertices reduced to less than 80 thousand, and the fps stabilized to about 30 frames.

3. Use only one dynamic light, not a shadow, not a illumination Probe

The particle system is the largest cpu.

4. tailoring the Particle System

5. Merge the simultaneous appearance of the Particle System

6. Implement a lightweight Particle System by yourself

Animator is also a very inefficient place

7. Use animation for all the places that do not need to transition to the skeleton animation or action, and control the number of bones to less than 30

8. animator does not update the field of view.

9. Delete meaningless animator

10. The initialization of animator is very time-consuming (it is not recommended to use animator on particles)

11. do not apply root motion with the skeleton except for the main character.

12. The static collider motion of objects without a rigid body and surrounded by a box is absolutely prohibited.

NUGI code is very inefficient. Basically, the cpu contribution of runtime is comparable to that of render.

13. The finalalpha of Recursive Computing for each frame is calculated only when initialization and changes are made.

14 remove normal Calculation

15 do not calculate viewsize and windowsize per frame

When 16filldrawcall is used, the vertex cache is built using array. copy.

17. Code tailoring: Use strip level and. net2.0 subset

18. Minimize smooth group

19. Set a strict scientific and verified art standard for the art, and configure the relevant check tools in U3D.

14th: what is the role of the Quaternary element?

Used to calculate the Rotation Angle

October 15: select the ClearFlags option of the Camera component to Depth only? What is the purpose?

If you select Deapth Only for ClearFlags, the camera will render Only visible objects and make the background completely transparent. This situation is generally used in scenarios with more than two cameras.

16th: When editing a scenario, how does one set GameObject to Static?

When the game object is set to Static, when these parts are blocked and invisible by Static objects, the grid objects will be removed (or disabled. Therefore, all non-moving objects in your scenario should be marked as Static.

: There are two groups of objects A and B. Is there any way to ensure that group A objects are always rendered first than group B objects?

Render the rendering queue of A group of objects whose columns are greater than those of B by using the rendering queue in the shader.

: Select "Texture" and "Sprite" for the TextureType option of the image.

Sprite is used as the UI Genie and Texture is used as the model Texture. Sprite requires a power of 2 to save resources by packaging images.

29th: I asked a Terrain question about the rendering speed of three, four, and five surface textures respectively? Why?

There is no difference, because no matter how many textures are rendered only once.

90: What is DrawCall? What is the impact of a higher DrawCall? How to Reduce DrawCall?

In Unity, each time the engine prepares data and notifies the GPU, it is called a Draw Call. The higher the DrawCall, the larger the consumption of the video card. Method To reduce DrawCall:

9th: What are the advantages and disadvantages of real-time point light sources?

Cookies are available-Cubemap textures with alpha channels. Point light sources are the most resource-consuming.

: In the Shader of Unity, what does Blend SrcAlpha OneMinusSrcAlpha mean?

The role is Alpha mixing. Formula: Final color = source color x source transparency value + target color x (1-source transparency value)

Ninety-three: Briefly describe the Rendering Principle of Water Reflection

The principle is to disturb the texture of the water surface to produce the effect of the wave light Lingling. Shader can be used to make disturbance at the pixel level through GPU, with delicate effects, less vertices required, and faster speed.

14th: Briefly describe the role of Grid and Table in NGUI?

Sort and locate sub-objects in the Grid and Table

: Briefly describe the functions of Panel and Anchor in NGUI

3. UIPanel is used to collect and manage all widgets under it. Create the actual draw call using the widget geometry. No panel can be rendered. You can use UIPanel as a Renderer.

: You can use foreach to traverse the objects to be accessed.Interface or declaration ___Method Type

IEnumerable; GetEnumerator

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.