当前位置:网站首页>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 .
边栏推荐
- el-select,el-option下拉选择框
- Quick start of UI component development of phantom engine [umg/slate]
- 【软件逆向-分析工具】反汇编和反编译工具
- The latest blind box mall, which has been repaired very popular these days, has complete open source operation source code
- Flume configuration 4 - customize mysqlsource
- [Chongqing Guangdong education] 2777t green space planning reference questions of National Open University in autumn 2018
- IPv6 experiment
- 看 TDengine 社区英雄线上发布会,听 TD Hero 聊开发者传奇故事
- C file in keil cannot be compiled
- 为什么腾讯阿里等互联网大厂诞生的好产品越来越少?
猜你喜欢
Zero foundation uses paddlepaddle to build lenet-5 network
Idea inheritance relationship
Leetcode92. reverse linked list II
Azkaban概述
SQL performance optimization skills
Share the newly released web application development framework based on blazor Technology
Asemi rectifier bridge 2w10 parameters, 2w10 specifications, 2w10 characteristics
el-select,el-option下拉选择框
Pytest (4) - test case execution sequence
Voice chip wt2003h4 B008 single chip to realize the quick design of intelligent doorbell scheme
随机推荐
Design and practice of kubernetes cluster and application monitoring scheme
英语必备词汇3400
Port, domain name, protocol.
Single box check box
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
How to make OS X read bash_ Profile instead of Profile file - how to make OS X to read bash_ profile not . profile file
Mongodb common commands
ICSI213/IECE213 Data Structures
Leetcode42. connect rainwater
Use of kubesphere configuration set (configmap)
Share the newly released web application development framework based on blazor Technology
[105] Baidu brain map - Online mind mapping tool
VM in-depth learning (XXV) -class file overview
[groovy] string (string splicing | multi line string)
Monitoring web performance with performance
In MySQL Association query, the foreign key is null. What if the data cannot be found?
2.常见的请求方法
Eight days of learning C language - while loop (embedded) (single chip microcomputer)
[安洵杯 2019]不是文件上传
MySQL winter vacation self-study 2022 11 (10)