当前位置:网站首页>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 .
边栏推荐
- Utilisation simple de devtools
- DECLARE_ WAIT_ QUEUE_ HEAD、wake_ up_ Interruptible macro analysis
- Accuracy problem and solution of BigDecimal
- Port, domain name, protocol.
- How to make the listbox scroll automatically when adding a new item- How can I have a ListBox auto-scroll when a new item is added?
- Necessary fonts for designers
- [summary of two registration methods]
- Delphi free memory
- El tree whether leaf node or not, the drop-down button is permanent
- [system security] ten thousand words summary system virtualization container bottom layer principle experiment
猜你喜欢
Tiny series rendering tutorial
Sqoop installation
Azkaban安装部署
IPv6 experiment
深度学习——LSTM基础
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Logstash、Fluentd、Fluent Bit、Vector? How to choose the appropriate open source log collector
Subversive cognition: what does SRE do?
单项框 复选框
About MySQL database connection exceptions
随机推荐
端口,域名,协议。
About MySQL database connection exceptions
Yuancosmic ecological panorama [2022 latest]
Design and practice of kubernetes cluster and application monitoring scheme
Technology sharing swift defense programming
Yyds dry goods inventory intelligent fan based on CC2530 design
Blue Bridge Cup single chip microcomputer -- PWM pulse width modulation
There is a question about whether the parallelism can be set for Flink SQL CDC. If the parallelism is greater than 1, will there be a sequence problem?
NPM introduction link symbolic link
Tiny series rendering tutorial
De debugging (set the main thread as hidden debugging to destroy the debugging Channel & debugger detection)
Clean up PHP session files
Pdf things
Yyds dry goods inventory embedded matrix
Talk about the SQL server version of DTM sub transaction barrier function
Why are there fewer and fewer good products produced by big Internet companies such as Tencent and Alibaba?
Sqoop installation
1.五层网络模型
Easy processing of ten-year futures and stock market data -- Application of tdengine in Tongxinyuan fund
Is there any way to change the height of the uinavigationbar in the storyboard without using the UINavigationController?