Unity3d Interview--Real interview, Unity3d interview

Source: Internet
Author: User

Originally wanted to write a series, half is to attack the current interview water, the need to rape, with eldest brother's words, to go novice is to do screws and rags with. The other half is to give a more valuable reference to the friends who are out of school or who have turned 3d from the useless martial Arts. But I have a rush of time. No guarantee, write a little bit.
First identify what you're going to do when you get to the company:
1.UI (face questions will be biased to Ngui and other UI operations, the examination to some simple sorting algorithm, data structure, problem-handling ideas, etc.)
2. Data Logic Layer (certificate of examination to data structure collocation, configuration table construction, etc.)
3. Game Control Process (Certificate of examination to state machine design, design with server protocol, and small amount of Lua or Python scripting content)
4. Project schema (main content: You know. Anyway, I'm not good enough for this. )

UI nothing to say, go after every day layout, no fun, but, novice have to abuse once, just can. The data logic layer, which is to coordinate the background data of the whole game, according to the data given by the network module, maintains the stability of the whole data base and swift. This work has nothing to do with unity, but it is essential that the general resume has written about what ACM is like and will let you do this. Game control process, to begin to enter the ranks of senior programmers, you will be exposed to a lot of unity-related content, such as the release of skills, character Dressup, character state control and other interesting content, usually if you are not from the waste of martial arts to 3d or the original company did this, just tired of job-hopping only, is not to let the novice do this. Project structure I'm not qualified to talk about this.

It's supposed to end this nonsense, but it might lead to a new view of the UI-it's not worth doing. In fact, the UI is boring, but it is novice contact engine, familiar with the best channel of code, but also all the companies are willing to open up a free training channel for beginners, because the UI code is very cheap, you go to anyone can connect, so they are willing to use the novice.

Let's talk about what I would ask if I was interviewing the "SB" for the exam. These problems are the project in the Pit me, hurt me, let me cry let me pain problem.
UI aspect:
1. Why do you think the UI camera and the scene camera work together and work so well?
Answer: The UI camera and scene camera belong to two render layers (layer) respectively, so the rendering between them does not interfere with each other. The reason they work so well (there's no confusion, the UI is always on top of the scene) is because the camera depth (depth) controls well.

2. How do you feel about preventing UI controls from being Dianchuan (how to filter out click events)?
Answer: Use a Render object or Pannel to bind the Boxcollider component. If you only have a non-rendered object (Uiwiget here), even if you set the size and Boxcollider, it is not blocked. (Pit here).
3. Questions about Uigrid
Answer: I basically do not use Uigrid, I will directly in the code set Localpos and so on. (This control is very pit).

4. How do you feel about communicating with each other in the UI function module? (or ask for broadcast and Sendmes's opinion)
(This topic is my quilt cover of a topic, quite essence, later asked me this topic of people became my colleague, thank him not to be more than I answered at that time is very fucked, and now he still as teacher general help me. )
Answer: Try to decouple between UI modules, using broadcast wit or delegate wit. Because Unity's own broadcast and sendmsg efficiency is very low, (be sure Baidu a bit of the difference between the two, there are, I am too lazy to copy and paste. So it is recommended to use the Ngui to bring the message wit. Specific use of the method, download any version of NGUI3.5, can be clearly seen. More or the realization of their own msgerpool can also be, the idea is to use generic notation + dictionary +delegate, the efficiency is very high.

5. Find him 1100 degrees in the crowd, how can you quickly locate a UI control.
Answer: Divide the situation to deal with, this is an optimization strategy topic. First, if this control I can know when awake, then I will save it as a private variable, in the code when used directly. If not, the sub-object is dynamically generated (he might or may not), so use findchild as much as possible and then judge. If you have to find something globally (such as finding a character object), you will use Find.

6. What are your good strategies for blocking relationships?
Answer: The birth of this kind of problem is because Ngui2 uses a kind of zorder+depth way to deal with the occlusion relation, it has been completely screened out in Ngui3. Just maintain the depth.

7. What are your good ideas for screen fitting?
Answer: screen adaptation at all there is no perfect solution, if it is a full-screen module, then lock the target model, the target model into full screen, other models full width or high after leaving White (also called Left Black edge) processing can be. If it is a screen module (such as the combat interface, the main city interface, etc., you will see the scene below), need to use anchor to solve. NGUI2 anchor have independent control, Ngui3anchor has been engaged in Wighet and pannel, this oneself go down to study well.
The UI is so much, if asked, you answer well, want to thank me, please come more bull look ~

Data logic Layer aspects
1. Please briefly describe what you think about the data structure selection
Answer: Bulk fetch, often traverse the data, will take a list to store, often find will take the dictionary store. At the same time if more than one field is important (such as a configuration table often ID index and name index), I will open up multiple dictionaries for storage, sacrificing space for reverse lookup efficiency.

2. Please parse this configuration file into the data structure you want, show me
Answer: If this configuration file is XML or JSON, then it will be converted to Hashtable first, then you can have a field based on the configuration table (for example, there is an object, it has "use to increase physical strength" this field, some no, You need to use ContainsKey to detect if there are any fields, and then split it up and into the data structure you want, if you want to be a dictionary, you need to note that when you join the key, you should ask whether it contains the key, if it contains, then modify, if not included, add, There is no problem with our intelligence. Try it and it will be clear.
If this configuration file is Excell, then it will be converted into a string array, each element of the array, is a field data, according to the order of the configuration table to be taken out to deposit in your data structure.

3. Please briefly describe the use of struct and class in C #
(Thanks again for the interview I got that colleague who tolerated my answer sucks)
Answer: If you are a self-abandoned martial arts, from C + + to C #, these two things will surprise you. There is almost no difference between structs and classes in C + +. In C #, structs belong to objects, and classes are references, structs do not need new, and classes must be new. It's a huge hole. Like you've got a structure linked list:
list<structa> structtestlist = new list<structa> ();
Then inject the data into the list, inject the data, you want to change one of the links, you do
Structa structlink = structtestlist[2];
Structlink.data = 3;
In doing so, there is no change to the Structtestlist value! Because the statement structlink that sentence, is an object, not pointing to that (link) "Pointer"!
But if it's class, you have no trouble with it.
This thing is recommended for everyone to try. It's a pit.

4. What will you do if you receive data from the network?
Answer: Before embarking on the project, there will be a txt, the client internal message protocol listed above, this message protocol is the network protocol processing map. For example, the network protocol tells me, "because you just took a medicine, eat successfully, now you have to give me refresh, so that users can see greatly", I must notify the implicated module: "You have to refresh the data, and then the old place again, refresh the interface to the user greatly see." The module involved, such as the combat UI, it is to add the blood bar, as well as the character information of the data base, change the current blood volume data and so on. After the modules receive the protocol, they change their values: For example, the UI is taken from the data, and the data base is taken from the network packet or configuration table, and so on.

Game Control Flow:
1. What do you think about resource loading?
Answer: First of all the resources to load this thing, is the persistent, users over and over the spit slot loading slow, but who also do not want to let the loading of less cause must be loaded behind and become sluggish. For the more expensive load, is the IO operation, when the game just landed, the initialization is loaded. Force loading of some important modules, such as the login window (where the user enters the user name password) and so on. Selectively load some necessary modules: if this person needs novice boot, then load the Novice boot module, otherwise not load, or vice versa. These users will certainly use (or do not need) the module, at the time of landing processing. For the application module: For example, I open a very large UI, this how to load, if the module is very gold, the user has a large probability, then it must be loaded at the time of landing, otherwise it can only be opened by the user load, when the load should be a circular prompt users. More consensus about the scene loading. Since everybody quilt cover to this step, believe also don't need me nonsense, a program has a program of living the living is not it?

2. Please design a state machine for me to complete a simple XXXX scenario.
A: The state machine is not a simple switch structure, if you are a novice, you say switch I can tolerate, if you do a few years 2Dx, and then want to u3d, and then switch directly pass. can go to search the relevant information, water is not very deep, but space is limited. Presumably, each object maintains its own state machine, state machine state changes, and state triggers. All States (not state machines): State machine is a supervisor it is responsible for dispatching various States, state is various ... State.. Hey, inexpressible. ), will rewrite the begin,excute,end these three functions, originally knocked a lot of. Found that said also not clear, everyone go to see it or. After all, it only offers a way to interview.

3. Role Dressup, skill release what will you do.
The role of this, each have their own living, body block dress, paper doll stickers, such as, this consensus, can own Baidu go, find a oneself like to realize to try it. The ability to release water is very deep, this can answer to answer, do not come up also not ashamed. Estimated quilt cover These, certainly is stronger than me, also does not need me to compare what.

4. What is the view of dynamic update?
Answer: This problem involves assetbundle. Among them, assetbundle face the resources of the treatment method is very different. For example, prefab, can be very good to get up, for binary files, but also can make good, but for the code this thing, is often the focus of the debate--after all, the code this thing, Iosappstore is certainly not let you do, because unity itself is not to be seen by Apple, So it is afraid of being killed by the second, nor to provide users with the ability to update the script. This leads you to update a prefab, and you can't use the script that hangs on it! The update has a JB with ... To provide some idea of fixing the code update, now I try to do this piece, further reseach, light spray
Android can use the unityreflaction mechanism for post-compilation code dynamic update, the vast majority of Google developers are sure to know. But the problem is that this kind of mechanism can lead to huge development costs-from the code level completely with the iOS to make a big branch, if you want to cross-platform, this is probably not advisable it.
The second is the ability to write seamlessly using Lua scripts, because the unity script is not a real script, and the power of the real script is that it can be dynamically compiled onto the host, which is awesome. Lua is such a kind of script. So you can change Lua seamlessly ... That's fine. So the project should be to think well is LUA or what. Don't come back half, want to change Lua, that is SB.
These two mechanisms are definitely not for you in the App Store, the first, jailbreak platform is not allowed, because unity does not let you engage.
In fact, there are mysterious third way, this third way, do not share, after all, there is no experiment, say to fear abusing everyone.

Original address: http://www.cnblogs.com/android-blogs/p/6344067.html

Unity3d Interview--Real interview, Unity3d interview

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.