This is the unity I just organized the interview questions, in order to help everyone to interview, while helping everyone to better review unity knowledge points, if you find anything wrong, (including typos and knowledge points), or find out where the description of the unclear, please leave a message below, I will update again, I hope we can help the developers together.
A: What is a collaborative program?
While the main thread is running while another logical processing is in hand to assist in the execution of the current program, the process is much like multi-threading, but not multi-threading, and unity's process is actually checking whether the yield condition is satisfied after the end of each frame.
Two: The difference between the collider and the trigger in Unity3d?
A collider is the carrier of a trigger, and a trigger is just a property of the collider. When is Trigger=false, the collider is based on the physical engine to trigger collisions, the effect of collisions, you can call the Oncollisionenter/stay/exit function, when is trigger=true, the collider is ignored by the physical engine, no collision effect, You can call the Ontriggerenter/stay/exit function. A trigger can be used if you want to detect an object's contact without having to let the collision detection affect the movement of the object or to detect whether an object is passing through an area of space.
Three: What are the necessary conditions for an object to collide?
Two objects must have a collider (Collider), one of which must also have a rigidbody rigid body, and must be a moving object with a rigidbody script to detect collisions.
Four: Please briefly describe the main differences between ArrayList and list?
ArrayList there is an insecure type (ArrayList will treat all the data inserted as an object)? Packing and unpacking operations (time consuming)? List is an interface, ArrayList is a class that implements the interface and can be instantiated
Five: How to safely migrate asset data between different projects? Three different methods
1. Migrating the Assets directory with the library directory
2. Export Package
3. Assets Server features with Unity
Six: onenable, Awake, start run time of occurrence order? Which may occur repeatedly in the same object cycle
Awake–>onenable->start,onenable can occur repeatedly in the same cycle.
Seven: The difference between material and sharedmaterial in Meshrender?
Modifying the sharedmaterial will change the appearance of all objects using this material and also change the material settings stored in the project. Modifying the material returned by Sharedmaterial is not recommended. If you want to modify the shader's material, use material instead.
Eight: Unity offers several sources of light, what are the different
Four kinds.
Parallel Lights: Directional light
Point lights: Dot Light
Spotlight: Spot Light
Area lights: Areas Light
Nine: Briefly describe the object pool, what do you think is suitable for using object pool in FPS?
The object pool stores a space that needs to be repeatedly called, and when an object is generated back to a large number of times, if it is time to destroy the creation, the object pool is used to put the objects that are temporarily unused into a pool (that is, a collection), and the next time you want to regenerate the object, go to the pool to find out if there If there are words directly out of use, do not need to create, if there are no available objects in the pool, it is necessary to re-create, the use of space-time to achieve high-speed game performance, in FPS games to be frequently copied objects including bullets, enemies, particles, etc.
Ten: The difference between Charactercontroller and rigidbody
Rigidbody has a completely real physical nature, the most basic component of the physical system in Unity, which contains the common physical characteristics, and Charactercontroller can be said to be limited rigidbody, with certain physical effects but not completely true, is a component that unity encapsulates in order to make it easy for developers to develop first-person-view games
11: Brief description of the usefulness of prefab
In the game runtime instantiation, prefab equivalent to a template, you already have the footage, scripts, parameters to make a default configuration, so that later changes, while prefab packaged content simplifies the operation of the export, easy to communicate with the team.
12: Please briefly describe the role of the sealed keyword when it is declared with a function in a class declaration
Sealed-Modified classes are sealed classes, and class declarations prevent other classes from inheriting this class, which is declared in a method to prevent derived classes from overriding this method.
13: Please briefly describe the difference between private,public,protected,internal
Public: Open for any class and member, unrestricted access
Private: Public only for this class
Protected: Exposes the class and its derived classes
Internal: The class can only be accessed in the assembly that contains the class
14: There are several ways to implement 2d games using Unity3d?
- Using its own GUI, the Ugui appears after the Unity4.6
2. Adjust the projection (projection) value of the camera to orthographic (orthogonal projection), regardless of z-axis;
3. Using 2d plugins, such as: 2DToolKit, and Ngui
XV: In the whole process of collision, there are several stages, the corresponding functions are listed separately
Three stages, 1.OnCollisionEnter 2.OnCollisionStay 3.OnCollisionExit
16: In the physics engine of Unity3d, there are several ways of exerting force, which are described separately.
Rigidbody. Addforce/addforceatposition, all in the Rigidbody series function. You can check out the Rigidbody API for yourself.
17: What is a chain joint?
Hinge Joint, can simulate two objects with a chain connected together, can maintain two objects within a fixed distance of each other moving without force, but reached a fixed distance will produce tension.
18: The function that the object rotates using?
Transform.rotate ()
19: Unity3d provides a class for saving and reading data (playerprefs), listing functions for saving and reading shaping data
Playerprefs.setint () Playerprefs.getint ()
20: Unity3d script from Wake-up to destruction there is a relatively complete set of life cycles, please list the system comes with several important methods.
Awake-->onenable–>start-->update-->fixedupdate-->lateupdate-->ongui-->ondisable--> OnDestroy
21: Which system function is the physical update generally placed in?
Fixedupdate, every fixed frame is executed once, and update is different fixedupdate is rendered frame execution, if your rendering efficiency is low, fixedupdate calls will be followed down. The Fixedupdate comparison is applicable to the calculation of the physics engine because it is related to each frame rendering. Update is more appropriate for control.
22: What happens when you place multiple camera in a scene and are active at the same time?
The game interface can see a mix of many cameras.
23: How do I destroy a unityengine.object and its subclasses?
Use the Destroy () method;
24: Describe why data loss occurs on components in Unity3d
Objects that are bound to the assembly are usually deleted.
25: What is LOD and what are the pros and cons?
LOD (level of detail) multi-layered detail is the most commonly used game optimization technique. It determines the resource allocation of object rendering according to the position and importance of the model, reduces the number of non-important objects and the detail degree, and obtains the efficient rendering operation. The disadvantage is that the memory is increased.
26: What is mipmap, function?
MipMapping: There are commonly used techniques for mapping rendering in three-dimensional computer graphics, in order to speed up rendering progress and reduce image aliasing, the map is processed into a series of pre-computed and optimized pictures of the file, such a map is called mipmap.
27: Please describe the difference between interface and abstract classes
Abstract classes indicate that there may already be some concrete definitions of the methods in the class, but the interface is the interface that the father-in-law can only define each method, not the specific implementation code in the member method. A class is a subclass that is inherited by a method that is not necessarily implemented in a subclass when the parent class already has an actual function, and the subclass can override the method of the parent class by directly referencing the method of the parent class. When implementing an interface, you must implement all the methods in the interface, and you cannot omit any of them.
28:. NET and mono?
Mono is an open-source cross-platform tool for. NET, just like a Java virtual machine, Java itself is not a cross-platform language, but running on a virtual machine enables a cross-platform.. NET can only run under Windows, Mono can be run across platforms, can operate on Linux,unix, Mac OS and so on.
29: Brief description of the name of the language supported by Unity3d as a script
Unity's scripting language is run on the. NET platform of mono and can be used with. NET libraries, which also provides a good solution for issues such as XML, databases, regular expressions, and so on. The scripts in Unity are compiled, and they run fast. These three languages actually function and run the same speed, the difference is mainly reflected in the language characteristics. JavaScript, C #, Boo
30: Component name in U3d for recording node space geometry information and its parent class name
Transform Parent class is Component
31: The point multiplication of vectors, the meaning of cross-multiplication and normalization?
1. The point multiplication describes the similarity of two vectors, the larger the result, the more similar the two vectors are, and the projection
2. The vector obtained by the fork is perpendicular to the original two vectors
3. Normalization vector: Used in the relationship only direction, do not care about the size of the time
32: Why everyone is looking for alternatives to u3d native GUI on mobile devices
Not beautiful, Ongui is time-consuming, inefficient, inconvenient to use
33: Please describe how to maintain the consistency of the UI at different resolutions
Ngui a good solution to this, the screen resolution of the adaptive, the principle is to calculate the screen aspect ratio with the original preset screen resolution to find a comparison value, and then modify the size of the camera. Ugui also solves this problem through anchor points and center points and resolution
34: What is Lightmap?
Lightmap: Refers to the three-dimensional software to achieve a good light, and then render the scene of the surface of the light output to the map, and finally through the engine attached to the scene, so that the object has a sense of light.
35: The difference between unity and cocos2d
Unity3d supports C #, JavaScript, etc., Cocos2d-x supports C + +, HTML5, Lua, and more.
Cocos2d Open Source and free
Unity3d support iOS, Android, Flash, Windows, Mac, Wii and other platform game development, Cocos2d-x support iOS, Android, WP and so on.
36: What is the difference between C # and C + +?
Simply put: C # compared to C + +, the most important feature is that C # is a completely object-oriented language, and C + + is not, in addition to C # is based on the Il Intermediate language and the. NET Framework CLR, in portability, maintainability and robustness of C + + has a great improvement. C # is designed to develop fast, stable, and extensible applications, but can also do some of the underlying operations through interop and PInvoke. For a more detailed distinction, you can refer to this
37: What is the difference between a struct and a class?
A struct is a value type, and a class is a reference type. (a value type, a reference type is divided according to the angle of the data store) is the value that the value type uses to store the data, and the reference type is used to store a reference to the actual data. Then the struct is used as a value, and the class uses references to manipulate the actual data.
38: What is the ref parameter and the out parameter? What's the difference?
The effect of the ref and out parameters is to find the memory address of the variable defined in the main function by keyword, and change its size by the syntax of the method body. The difference is that the output parameter must initialize the parameter. Ref must be initialized, and out parameters must be assigned values in the function. The ref parameter is a reference, and the out parameter is an output parameter.
39: What is a delegate for C #? What's the use?
A delegate is similar to a secure pointer reference that is treated as a class when used, rather than a method, which is equivalent to a reference to a list of a set of methods. Useful: Use a delegate to enable a programmer to encapsulate a method reference within a delegate object. You can then pass the delegate object to the code that invokes the referenced method without knowing at compile time which method will be called. Unlike function pointers in C or C + +, delegates are object-oriented and type-safe.
40: What sort methods are in C #?
Choose Sort, bubble sort, quick sort, insert sort, hill sort, merge sort
41: What is the principle of radiographic detection of colliding objects?
A ray is a zero-end line emitted by a point in the 3D world in One direction, which stops firing when colliding with other objects in the launch trajectory.
42: What is the role of the camera's clipping planes in unity? What should I pay attention to when adjusting the two values of near and fare?
Clipping plane. The distance from the camera to the start and stop rendering.
43: How to make an existing gameobject not be uninstalled after loadlevel?
void Awake () {dontdestroyonload (transform.gameobject);}
44: Please describe the reasons for GC (garbage collection) and how to avoid it.
GC reclaims the memory on the heap
Avoid: 1. Reduce the number of times new objects are created
2. Using common objects (static members)
3. Change the string to StringBuilder
45: How is the reflection implemented?
The ability to review metadata and gather information about its type. Implementation principle: The metadata is obtained at run time based on the assembly and its type. Here is the implementation step:
Import using System.Reflection;
Assembly.Load ("assembly") loads the assembly, and the return type is a Assembly
Get the names of all classes in the assembly
foreach (Type type in assembly. GetTypes ()) {string t = type. Name; }
4. Type type = assembly. GetType ("assembly. Class name"); Gets the type of the current class
Activator.CreateInstance (type); Create this type instance
MethodInfo mInfo = type. GetMethod ("Method name"); Get Current method
M.info.invoke (null, method parameter);
46: A brief description of the role of four yuan, four yuan to the advantages of Euler angle?
Four the number of elements used to represent rotation
Advantages relative to Euler's angle:
1. Capable of incremental rotation
2. Avoid the universal lock
3. There are two ways of expressing a given azimuth, each of which is negative (there are countless ways to express Euler angles).
47: In which function is moving the camera action, why in this function?
Lateupdate, which is called after all the update finishes, is more appropriate for the execution of the command script. Official online example is the camera follow, all the update operation is done before the camera follow-up, or there may be a camera has been advanced, but the perspective of the role of the empty frame appears.
48: How the GPU Works
In short, GPU graphics (processing) pipelining accomplishes the following: (and not necessarily in the order of the following) vertex processing: this phase of the GPU reads the vertex data that describes the appearance of the 3D graphic and determines the shape and position of the 3D shape based on the vertex data, and establishes the skeleton of the 3D graph. In GPUs that support DX8 and DX9 specifications, these work is done by hardware-implemented vertex Shader (fixed-point shaders). Rasterization calculation: The actual image displayed by the display is made up of pixels, and we need to convert the dots and lines on the generated graph to the corresponding pixel points by some algorithm. The process of converting a vector graphic into a series of pixel points is called rasterization. For example, a diagonal segment of a mathematical representation is eventually converted into a ladder-like continuous pixel point. Texture post: The polygons generated by the vertex cells only make up the contours of the 3D object, and the texture map (texture mapping) works on the multi-deformed surface, which is, in layman's words, the surface of the polygon affixed with the corresponding picture, thus generating "real" graphics. TMU (Texture mapping unit) is used to complete this work. Pixel processing: This stage (during rasterization of each pixel) the GPU completes the calculation and processing of the pixels to determine the final properties of each pixel. In GPUs that support DX8 and DX9 specifications, these work is done by hardware-implemented pixel Shader (pixel shaders). Final output: The output of the pixel is finalized by the ROP (Rasterization engine), and after 1 frames are rendered, it is sent to the memory frame buffer.
Summary: The GPU's work is generally done by completing the creation of 3D graphics, mapping the graphs to the corresponding pixel points, calculating each pixel to determine the final color and completing the output.
49: What is a render pipeline?
Refers to a series of necessary actions to be taken on a display to display an image. Many of the steps in the rendering pipeline are to transform a geometric object from one coordinate system to another. The main steps are:
Raster------------------------with view
50: How to optimize memory?
There are many ways, such as
1. Compress the own class library;
2. Hide the objects that need to be used in the future, instead of destroy them directly;
3. Release the resources occupied by Assetbundle;
4. Reduce the partial number of the model, reduce the number of bones in the model, reduce the size of the map;
5. Using a light map, using multi-level detail (LOD), using shaders (Shader), using presets (Prefab).
6. Fewer temporary variables in the code
51: How to dynamically load resources? The difference between them
1.resources.load ();
2.AssetBundle
Difference Reference
52: Please describe what kinds of game animations, and how it works?
There are mainly joint animation, skeletal animation, single mesh model animation (Keyframe animation).
Joint animation: The role is divided into several independent parts, a part corresponding to a grid model, part of the animation connected to a whole animation, the role of more flexible, Quake2 use this animation;
Skeletal animation, widely used in animation, the integration of the advantages of the above two ways, the skeleton by the role of the characteristics of a certain level of structure, joint, can do relative movement, skin as a single mesh outside the skeleton, determine the role of the appearance;
The single mesh model animation is composed of a complete mesh model, which records the original position of each vertex and its change amount in the key frame of the animation sequence, then the interpolation operation realizes the animation effect, and the character animation is more realistic.
53: How Alpha Blend works
Alpha Blend achieves transparency, but only Alpha for a block of regions, and transparency can be set.
54: Write the calculation formula of diffuse in light calculation
Diffuse = kd x colorlight x Max (n*l,0), KD diffuse factor, colorlight light color, N unit normal vector, L from point to light source unit vector, where N and L are multiplied, and if the result is less than or equal to 0, the diffuse is 0.
55: Two kinds of shadow judgment method, working principle.
Umbra and Penumbra: reference to Umbra and Penumbra
Umbra: Areas on the surface that are not directly irradiated by the light source (all-black, clearly defined areas).
Penumbra: Areas on the surface that are directly irradiated by certain light sources but are not directly irradiated by all specific light sources (semi-dark areas)
Working principle: From the light source to all the objects can meet the projection of light, these faces projected into the scene to get the projected surface, and then the projection surface and other planes in the scene to cross out the shadow polygon, save the Shadow polygon information, and then the scene by the point of view of the corresponding processing to get the required views (using space to change time , each time only a shadow calculation based on the position of the viewpoint is required, eliminating the need for a blanking process)
56: Vertex Shader is what, how to calculate?
A vertex shader is a program that executes on the GPU to replace the transformation and Lighting,vertex shader primary manipulation vertices in a fixed pipeline.
Vertex Shader completed the transformation of the input vertices from local space to homogeneous space (homogeneous spaces), homogeneous space, the next space in projection space. In the meantime there are several processes of world transformation, view transformation and projection transformation and lighting.
57: How many temporary objects does the following code produce in the run?
String a = new string ("abc"); A = (A.toupper () + "123"). Substring (0, 2);
The first line in C # will be an error (it is possible in Java).
This should be initialized:
String b = new string (new char[]{' A ', ' B ', ' C '});
The answer is: 5 Temporary objects
58: What happens when the following code is 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); }
Generates a run-time error in LS. Remove (item) This line because foreach is read-only. Cannot be modified while traversing.
59: Does Unity3d support writing multithreaded programs? What do you need to pay attention to if supported?
Only components that can access Unity3d from the main thread, objects and Unity3d system calls
Support: If you have to deal with a lot of things at the same time or interact with unity objects small can use thread, otherwise use coroutine.
Note: There is a lock keyword in C # to ensure that only one thread can access a specific object in a specific time period
60: What is the difference between a unity3d and a C # thread?
A multithreaded program runs multiple threads at the same time, and only one is running at any given time, and the running co-worker is suspended only when necessary. Threads other than the main thread cannot access Unity3d objects, components, methods.
Unity3d does not have a multi-threading concept, but unity also gives us a way to Startcoroutine (co-program) and Loadlevelasync (asynchronous load level) background loading scenarios. Why is Startcoroutine called co-operation, the so-called synergy, is when you in the Startcoroutine function body processing a piece of code, the use of yield statements to wait for the results, this period does not affect the continuation of the main program, you can work together.
61: The meaning and attention point of matrix multiplication
Used to represent linear transformations: rotation, scaling, projection, panning, affine
Attention to the creep of matrices: the accumulation of errors
62: Why the dynamic font outperforms the static font in the Unicode environment
Unicode is a character encoding scheme developed by international organizations that can accommodate all the words and symbols in the world.
When using dynamic fonts, unity will not pre-generate a character texture with all fonts. When you need to support Asian languages or larger fonts, if you use normal textures, the font texture will be very large.
63: What happens when a small, high-speed object hits another larger object? How to avoid it?
Penetration (Collision detection failure)
64: Please describe the timing of the occurrence of onbecamevisible and onbecameinvisible, and the meaning of this pair of callback functions?
When the object is visible and switched. Can be used for calculations that only need to be made when the object is visible.
65: What do you mean dynamic batch? What's the difference between a static and a batch?
If dynamic objects share the same material, unity automatically batches the objects. Dynamic batch operations are done automatically and do not require additional action from you.
Difference: Dynamic batching Everything is automatic, does not need to do anything, and the object can be moved, but a lot of restrictions. Static batching: A high degree of freedom, with few limitations, a disadvantage that may consume more memory, and all objects after a static batch can no longer be moved.
Reference
66: Describe the difference between StringBuilder and string?
strings are string constants.
StringBuffer is a string variable, thread safe.
StringBuilder is a string variable and thread is unsafe.
The string type is an immutable object that needs to generate a new string object each time a string is changed, and then point the pointer to a new object, and if you constantly change an object within a loop, you will constantly generate new objects, so it is inefficient It is recommended that you do not use string types where you constantly change the string object.
The StringBuilder object is modified on the original string while doing a string join operation, improving performance. This is a point we usually use to know that when the connection operation is frequent, use the StringBuilder object.
67: Unity3d shader What kind of different, what is the difference?
The surface shader has a high level of abstraction that makes it easy to implement complex coloring in a concise manner. The surface shader works correctly in both forward rendering and deferred render mode.
Vertex fragment shaders have the flexibility to achieve the desired effect, but need to write more code and are difficult to integrate seamlessly with Unity's rendering pipeline.
Fixed-function pipeline shaders can be used as an alternative to the first two shaders, and when the hardware fails to run those cool shader, you can also draw some basic content by fixing the functional pipeline shader.
68: The prototype of the known strcpy function is: char * strcpy (char * strdest,const char * strsrc); 1. Do not call the library function, implement the strcpy function. 2. Explain why you want to return char *
char * strcpy (char * strdest,const char * strsrc)
{
if ((strdest==null) | | | (Strsrc==null))
Throw "Invalid argument (s)";
char * strdestcopy=strdest;
while ((*strdest++=*strsrc++)! = ' + ');
return strdestcopy;
}
69: What are the four access modifiers in C #? What's the difference?
1. Property modifier 2. Access modifier 3. class Modifier 4. Member modifier.
Property Modifiers:
Serializable: Marshals an object to a remote server by value.
Statread: is a single-threaded suite meaning, is a threading model.
Matathread: is a multithreaded suite meaning, is also a threading model.
Access modifiers:
Public: Access is not restricted.
Private: Only the class that contains the member can be accessed.
Internal: Only the current project can be accessed.
Protected: Only the class that contains the member and derived classes can be accessed.
Class modifier:
Abstract: A class of abstraction. Indicates that a class can only be used as a base class for other classes.
Sealed: Sealed class. Indicates that a class cannot be inherited. Of course, sealed classes cannot be abstract classes at the same time, because abstractions always want to be inherited.
Member Modifiers:
Abstract: Indicates that the method or property is not implemented.
Sealed: Sealing method. You can prevent override (overloading) of the method in a derived class. Each member method that is not a class can be used as a sealing method, and the virtual method of the base class must be overloaded to provide a concrete implementation method. Therefore, in the declaration of a method, the sealed modifier is always used in conjunction with the override modifier.
Delegate: Delegate. Used to define a function pointer. Event-driven in C # is based on Delegate + event.
Const: Specifies that the value of this member is read-only and does not allow modification.
Event: Declares an event.
extern: Indicates that the method is implemented externally.
Override: Override. A new implementation of the inherited members of the radical class.
ReadOnly: Indicates that a domain can be assigned only at the time of declaration and within the same class.
Static: Indicates that a member belongs to the type itself and not to a particular object. That is, it can be used without being instantiated after it is defined.
Virtual: Indicates that the implementation of a method or accessor can be overridden in an inheriting class.
NEW: Hides the specified base class member from the derived class to implement the overridden functionality. To hide a member of an inherited class, declare the member in the derived class with the same name and decorate it with the new modifier.
70: What is the difference between heap and stack?
1.heap is a heap and stack is a stack.
2.stack of space is automatically allocated and freed by the operating system, and heap space is manually applied and released, and the heap is commonly assigned with the New keyword.
3.stack space is limited, and the heap space is a large free zone.
71: What is the difference between a value type and a reference type?
1. Data of value type is stored in the stack of memory, the data of the reference type is stored in the heap of memory, and only the address of the object in the heap is stored in the memory unit.
2. Value type access speed is fast, reference type access speed is slow.
3. Value types represent actual data, and reference types represent pointers or references to data stored in the memory heap
4. Value types inherit from System.ValueType, reference types inherit from System.Object
5. The memory allocation of the stack is automatically released, while the heap is in. NET, there will be a GC to release
6. A variable of value type directly holds the actual data, whereas a variable of the reference type holds the address of the data, that is, the object's reference.
72: Please write a worthy algorithm to find any one of Fibonacci sequences
Recursive implementations:
int Fib1 (int index)
{
if (index<1)
{
return-1;
}
if (index==1| | index==2)
{
return 1;
}
Return FIB1 (index-1) +fib1 (index-2);
}
Iterative implementations:
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;
}
See more implementation methods
73: What is the execution code of the synergistic program? What is the use of, what is the disadvantage?
function Start () {
The co-program Waitandprint executes within the start function and can be treated synchronously with the start function.
Startcoroutine (Waitandprint (2.0));
Print ("Before Waitandprint finishes" + time.time);
}
function Waitandprint (waittime:float) {
Pause execution waittime seconds
Yield Waitforseconds (waitTime);
Print ("Waitandprint" + time.time);
}
Role: A synergistic program can use the yield statement at any point during execution. The return value of yield controls when the recovery of the synergistic program executes downward. The Synergy program is excellent during the execution of the object's own frame. The synergistic program has no more overhead in performance.
Disadvantage: The co-program is not a real thread and may clog.
74: What is the Richter substitution element?
One of the fundamental principles of object-oriented design of the Richter replacement principle (Liskov Substitution Principle LSP). Popular point: Is the subclass object can be assigned to the base class object, the base class object cannot be assigned to the subclass object
Reference
75: What is the difference between a mock and a stub?
The difference between a mock and a stub: mock: Focus on behavioral validation. Fine-grained testing, the logic of code, is used in most cases for unit testing. Stub: Focus on State validation. Coarse-grained testing is used where a dependent system does not exist or is not implemented or is difficult to test, such as access to file systems, database connections, remote protocols, etc.
76: Overview of Serialization:
Serialization is simply a process of translating an object into a format that is easy to transfer. For example, you can serialize an object and then use HTTP to transfer the object between the client and server side over the Internet
77: The difference between heap and stack?
Stacks usually hold the steps that our code executes, such as the Addfive () method in code snippet 1, the int pvalue variable, the int result variable, and so on. And the heap is mostly objects, data and so on. We can think of stacks as a box that is stacked together. When we use it, each time we take a box from the top of the way. The same is true of stacks, when a method (or type) is called to complete, take away from the top of the stack, and then the next. Heap is not, like a warehouse, the storage of the various objects we use information, unlike the stack is that they are not immediately cleared out.
78: Overview of Agents and events in C #?
A proxy is a reference that defines a point to a method.
The essence of C # event is the encapsulation of messages, which is used as communication between objects; Sender is called event sender, receiver is called event receiver
79: How many clients interact with the server?
Sockets are also commonly referred to as "sockets," which enable physical connections between servers and clients and transmit data, primarily UDP and TCP two protocols. The socket is in the transport layer of the network protocol.
The HTTP protocol transmits the main HTTP protocol and HTTP protocol-based SOAP protocol (Web Service), the common way is HTTP post and get requests, Web services.
80: How does unity and Android interact with iOS?
Unity can work around Android and iOS, then send messages to unity via Android or iOS classes, calling methods in unity
81: How do I see the interview, the number of vertices and the number of draw call in the scene in Unity3d? How can I reduce the number of draw call?
In the upper right corner of the game view, click Stats. The technology to reduce draw call is draw call batching
This is 5.0 after the window-Profiler, the shortcut key is cmd + 7 (CTL + 7)
82: When will alpha test be used? What effect can you achieve?
Alpha Test, Chinese is the transparency test. In short, the alpha value of the point color value (that is, the output half4 of the previous frag) is compared to the fixed value in the V&f shader in the last fragment function output. The Alphatest statement is typically at the starting position in pass{}. Alpha test produces extreme results, either completely transparent, invisible, or completely opaque.
83: Unity3d Some ways to optimize resources on mobile devices
1. Use Assetbundle to realize resource separation and sharing, to control the memory in 200m, but also to realize the online update of resources
2. Vertex count for rendering both CPU and GPU are the most stressed contributors, reducing the number of vertices to less than 80,000, FPS stabilized to about 30 frames
3. Use only one dynamic light, not shadow, no light probe
The particle system is the big head on the CPU.
4. Tailoring the particle system
5. Merging of simultaneous particle systems
6. Implement a lightweight particle system yourself
Animator is also a place where efficiency is very poor.
7. Use animation in places where you do not need to transition to skeletal animation and movement, and control the number of bones below 30
8.animator out of view not updated
9. Delete meaningless animator
10.animator initialization is time-consuming (particles can be used to avoid animator)
11. Do not move with the skeleton except the protagonist apply root motion
12. Absolute prohibition of the Movement of Objects (static collider) without a rigid body with a bounding box
Nugi's code is inefficient, and basically the runtime's contribution to the CPU is comparable to that of render.
13 calculation of recursive finalalpha per frame changed to only initialize and change
14 removing the normal calculation
15 do not calculate viewsize and windowsize per frame
Build vertex cache at 16filldrawcall using array.copy
17. Code clipping: Using the Strip level, use the. net2.0 subset
18. Minimize Smooth Group
19. To set a rigorous and scientifically proven art standard for fine arts, with the appropriate inspection tools in the U3d
What is the effect of the 84:4-dollar number?
A four-dollar number is used to calculate the rotation angle.
85: What does it mean to select the Clearflags option of the camera component as depth only? What's the use?
If the camera's clearflags is checked as deapth only, then the camera will only render visible objects, the background will be completely transparent, this situation is generally used in more than two cameras in the scene
86: What is the effect of setting Gameobject to static when editing a scene?
When you set the game object to static, these parts are blocked by a static object and are not visible, and the mesh object is rejected (or disabled). Therefore, all objects that are not moving in your scene should be marked as static.
87: There are two groups of objects A and B, what is the way to ensure that a group of objects will always be rendered before the Group B objects?
Renders a set of objects with a render queue that is larger than the B object, rendered by the render queue inside the shader
88: What is the difference between "Texture" and "Sprite" selected for the TextureType option of the picture?
Sprites are used as UI sprites, texture action model maps. Sprite requires 2 full power, package picture Save resources
89: Ask a terrain, respectively affixed 3, 4, 5 map of the surface, rendering speed What is the difference? Why?
No difference, because no matter how many posters are rendered only once.
90: What is Drawcall? What's the impact of Drawcall? How to reduce Drawcall?
In unity, the process of preparing data and notifying the GPU every time the engine is called is a draw call. The higher the Drawcall, the greater the consumption of the graphics card. Ways to reduce Drawcall:
Dynamic Batching
Static Batching
Advanced features shader downgrade to a uniform low-level feature of shader.
91: What are the pros and cons of real-time point lighting?
You can have a cubic diagram (Cubemap) texture with an alpha channel cookies–. Point lights are the most resource-intensive.
92: What does Blend srcalpha oneminussrcalpha mean in Unity's shader?
The effect is alpha blending. Formula: Final color = source color x Source transparency value + target color x (1-source transparency value)
93: Brief description of the rendering principle of water surface reflection
The principle is to disturb the texture of the water surface, in order to produce the effect of lingling. With shader, the GPU can be used to disturb the pixel level, the effect is fine, the vertices need less, the speed is fast.
94: Describe the function of grid and table in Ngui?
Sorting and locating sub-objects under grid and table
95: Please briefly describe the role of panel and anchor in Ngui
As long as a half-pixel offset is provided, it allows the location of a control to be accurately displayed on the Windows system (only the anchor child controls will be affected)
If mounted on an object, then he can attach the object to the corner or edge of the screen.
3.UIPanel is used to collect and manage the components of all the widgets under it. Create the actual draw call from the widget's geometry. Without a panel, nothing can be rendered, and you can think of UIPanel as renderer.
96: An object that can be accessed with a foreach traversal needs to implement an interface or declare the type of the ___ method
Ienumerable;getenumerator
Unity's comprehensive face test (including answers)