当前位置:网站首页>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 .
边栏推荐
- 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
- [Yu Yue education] National Open University autumn 2018 8109-22t (1) monetary and banking reference questions
- SQL injection exercise -- sqli Labs
- The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
- 程序员的视力怎么样? | 每日趣闻
- 深度学习——LSTM基础
- Huawei MPLS experiment
- Basic knowledge of tuples
- 问下,这个ADB mysql支持sqlserver吗?
- Ask, does this ADB MySQL support sqlserver?
猜你喜欢

1.五层网络模型

Multi person online anonymous chat room / private chat room source code / support the creation of multiple chat rooms at the same time

Huawei MPLS experiment

Azkaban概述

New interesting test applet source code_ Test available

This + closure + scope interview question

Share the newly released web application development framework based on blazor Technology

Tiny series rendering tutorial

Smart pointer shared_ PTR and weak_ Difference of PTR

The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
随机推荐
51 independent key basic experiment
Usage scenarios and solutions of ledger sharing
Six stone programming: advantages of automated testing
[move pictures up, down, left and right through the keyboard in JS]
深度学习——LSTM基础
Azkaban overview
Why are there fewer and fewer good products produced by big Internet companies such as Tencent and Alibaba?
De debugging (set the main thread as hidden debugging to destroy the debugging Channel & debugger detection)
In MySQL Association query, the foreign key is null. What if the data cannot be found?
Pat class a 1162 postfix expression
Idea inheritance relationship
IPv6 experiment
Nmap使用手册学习记录
看 TDengine 社区英雄线上发布会,听 TD Hero 聊开发者传奇故事
Basic knowledge of tuples
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?
[groovy] string (string injection function | asBoolean | execute | minus)
Share the newly released web application development framework based on blazor Technology
Utilisation simple de devtools
Pdf things