当前位置:网站首页>Some enterprise interview questions of unity interview
Some enterprise interview questions of unity interview
2022-07-05 03:34:00 【Xiankui xan】
####1 What is a commission ? event What's the use of keywords ?
A delegate is a container , You can put function objects , And can trigger each function call of the delegate surface . Delegate the main user callback function .
public delegate void GreetingDelegate(int lhs, int rhs); // Define a delegate type
public GreetingDelegateMakeGreet; // Define a delegate variable .
MakeGreet(3, 4); // Trigger all function calls in the container
If we add functions to delegate variables externally , Then the delegation should be defined as public, There is another problem with this ,public An external person can also trigger this delegate , If I want to design it to be external, I can add callback , But the delegation can only be triggered inside the module , Then I can add one event To modify , Although this is public, But the external cannot trigger the delegation , Can only be triggered inside a class .
public event GreetingDelegateMakeGreet;
####2 Unity The camera has several modes , What is the imaging principle ?
Unity There are two modes of camera. One is perspective camera , One is an orthographic camera , The principle of perspective camera imaging is to use similar triangles to image , Here's the picture
The orthogonal camera projects directly to the screen for imaging
####3 UGUI How to package into atlas ?
UGUI Packaging atlas is divided into several steps , as follows
**Step1:** Turn on UGUI Atlas mode ,Editor->Project Settings There is sprite packer The pattern of .Disabled Indicates that it is not enabled ,Enabled For Builds It means that it will only be enabled when packaging ,Always Enabled Means to enable it forever . If it is enabled here, it means whether to automatically print small drawings into atlas
**Step2:** For each UI The pictures make the atlas to be entered tag name .
**Step3:** Package to generate atlas Window ------>Sprite Packer, Click on Pack You can package and generate the atlas .
####4 UGUI How to achieve UI Objects fade in and out ?
UGUI It's like Image These components , Inherit from Graphic class , This provides a method :
Alpha: Target alpha value
Duration: Time of gradient
ignoreTimeScale: Whether to ignore Time.scale
void CrossFadeAlpha(float alpha, float duration, bool ignoreTimeScale);
####5 Unity [MenuItem()], among [] What does that mean? ?
C# Inside [] The decorator of the expression , and Java The notes inside are similar , We can go through Api Function read to decorator .
such as ,Unity Editor Mode of [MenuItem(“ menu ”)] To decorate a function as a menu response function , So why add [MenuItem( menu )] Unity This menu will be generated ?Unity Read MenuItem This decorator , Know the path of this decorator , In this way, create a path in the menu according to this path , utilize C# The reflection of preserves the method decorated by this decorator , This method is called by clicking on the menu .
####6 AssetsBundle After the bag is played out .manifest What's the usage? ?
.mainfest It's a text file with ab The check code of the package , Dependency, resource content and other related information , This information is for developers , At the same time, this information is also entered as binary ab Inside the package , So use ab When packaging resources , You don't have to bring .manifest file .
####7 Image And RawImage The difference between ?
Image yes UGUI It shows the common components of a picture , He supports atlas 、 Separate pictures . Generally, we use Image Components to show , Because the atlas can merge the pictures in the same atlas drawcall, This improves performance .Image Support Jiugongge and other modes .
RawImage Components are UGUI For displaying a single picture , It does not support atlas , So different pictures RawImage Occupy one alone drawcall,RawImage You can directly modify the mapping uv Parameters , This can adjust the display of the picture . A rolling background similar to that of an airplane can be used RawImage To keep changing uv Coordinates to achieve the rolling of the background image .
####8 Unity What are the specific folder names , What's the role ?
Unity There are some commonly used folder names in the project , The names of these folders are Unity Stipulated , Their respective functions are as follows :
Editor: The code and resources in this directory are editor Editor Code and resources in mode , Will not be driven into the inclusion , It will not be executed at runtime .
Resrouces: Use Resources.load All loaded resources should be put under this path , No matter whether this resource is useful or not, all resources under this path will be entered into the package when packaging .
StreammingAssets: have access to UnityWebRequest To load local files , All files in this folder will be entered into the package , When loading, you can use web The way to load .
Plugins: Directories of various platforms used to store plug-ins , such as x86, android, iOS etc. .
####9 If the project needs to be empty , How do you deal with ?
The project needs to be empty , When we were developing , Don't put anything in the scene , Otherwise, as the scene packaging resources are also entered, it is not an empty package . meanwhile Resources And StreammingAssets You can't put resource packs , Only in this way can we make an empty bag , How do we use resources ? There is only one way , Download resources from the server Ab package , Then add the resource to the scene when it is running .
####10 If you're an architect , How would you manage resources ?
Resource management is Unity A very important module in framework design , Let's first analyze the requirements , Resource management needs
1. Code loading resource and resource release interface
2. Complete resource update mechanism and management
3. Support empty bags at the same time , It also supports playing ordinary game packs .
4. Do a good job in version management and channel management .
To achieve the first requirement , If we use Resource.load To load the , Then it's very inconvenient to update resources with empty packages , So give up Resources. At the same time, the code should be loaded , We use pure AssetsBundle Mechanism to design . All resources are based on AssetsBundle To manage , load , Release .
AssetsBundle It has complete and mature updates and solutions . It's also convenient to empty your bag , hold ab Package deployment to server , Download to the local first , Then load locally ab package . Packing Ab When the package , Sub channels , Sub platform , Generate different ab Package resources . If you don't pack empty bags , Just put these ab Put in bags StreammingAssets Use this under the directory StreammingAssets Method to load ab package . First from ab Package download directory loading , without , Just arrive StreammingAssets Load under directory , In this way, the latest downloaded will always be loaded , The second is what is carried by the inclusion .
边栏推荐
- Delphi free memory
- Why do some programmers change careers before they are 30?
- Three line by line explanations of the source code of anchor free series network yolox (a total of ten articles, which are guaranteed to be explained line by line. After reading it, you can change the
- 1.五层网络模型
- [groovy] string (string type variable definition | character type variable definition)
- Share the newly released web application development framework based on blazor Technology
- Kubernetes -- cluster expansion principle
- Clean up PHP session files
- Qrcode: generate QR code from text
- [Yu Yue education] National Open University autumn 2018 8109-22t (1) monetary and banking reference questions
猜你喜欢
Smart pointer shared_ PTR and weak_ Difference of PTR
Share the newly released web application development framework based on blazor Technology
SQL injection exercise -- sqli Labs
How to define a unified response object gracefully
Pat class a 1160 forever (class B 1104 forever)
Yyds dry goods inventory intelligent fan based on CC2530 design
Simple use of devtools
LeetCode146. LRU cache
[2022 repair version] community scanning code into group activity code to drain the complete operation source code / connect the contract free payment interface / promote the normal binding of subordi
程序员的视力怎么样? | 每日趣闻
随机推荐
Sqoop命令
Daily question 2 12
About MySQL database connection exceptions
Learning notes of raspberry pie 4B - IO communication (I2C)
Easy processing of ten-year futures and stock market data -- Application of tdengine in Tongxinyuan fund
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Technology sharing swift defense programming
Pat class a 1162 postfix expression
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Three line by line explanations of the source code of anchor free series network yolox (a total of ten articles, which are guaranteed to be explained line by line. After reading it, you can change the
[summary of two registration methods]
Azkaban installation and deployment
[2022 repair version] community scanning code into group activity code to drain the complete operation source code / connect the contract free payment interface / promote the normal binding of subordi
Ask, does this ADB MySQL support sqlserver?
Utilisation simple de devtools
Machine learning experiment report 1 - linear model, decision tree, neural network part
Use UDP to send a JPEG image, and UPD will convert it into the mat format of OpenCV after receiving it
El select, El option drop-down selection box
Anchor free series network yolox source code line by line explanation four (a total of ten, ensure line by line explanation, after reading, you can change the network at will, not just as a participan
Zero foundation uses paddlepaddle to build lenet-5 network