当前位置:网站首页>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 .
边栏推荐
- In MySQL Association query, the foreign key is null. What if the data cannot be found?
- Class inheritance in C #
- [groovy] loop control (number injection function implements loop | times function | upto function | downto function | step function | closure can be written outside as the final parameter)
- Bumblebee: build, deliver, and run ebpf programs smoothly like silk
- 【做题打卡】集成每日5题分享(第三期)
- Azkaban actual combat
- SPI and IIC communication protocol
- Logstash、Fluentd、Fluent Bit、Vector? How to choose the appropriate open source log collector
- Azkaban安装部署
- Azkaban installation and deployment
猜你喜欢
How to learn to get the embedding matrix e # yyds dry goods inventory #
Huawei MPLS experiment
Class inheritance in C #
Talk about the SQL server version of DTM sub transaction barrier function
De debugging (set the main thread as hidden debugging to destroy the debugging Channel & debugger detection)
【软件逆向-基础知识】分析方法、汇编指令体系结构
Sqoop command
Design and practice of kubernetes cluster and application monitoring scheme
Flume configuration 4 - customize mysqlsource
Machine learning experiment report 1 - linear model, decision tree, neural network part
随机推荐
SQL performance optimization skills
SFTP cannot connect to the server # yyds dry goods inventory #
[groovy] string (string injection function | asBoolean | execute | minus)
Kuboard
Quick start of UI component development of phantom engine [umg/slate]
Azkaban actual combat
[learning notes] month end operation -gr/ir reorganization
Google Chrome CSS will not update unless the cache is cleared - Google Chrome CSS doesn't update unless clear cache
Tiny series rendering tutorial
Necessary fonts for designers
El select, El option drop-down selection box
IPv6 experiment
[deep learning] deep learning reference materials
Utilisation simple de devtools
Use of kubesphere configuration set (configmap)
1. Five layer network model
Anti debugging (basic principles of debugger Design & NT NP and other anti debugging principles)
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
v-if VS v-show 2.0
Pat class a 1162 postfix expression