当前位置:网站首页>Unity screenshot method
Unity screenshot method
2022-06-30 05:10:00 【Shannan HSY】
Here is my summary 、 stay u3d Medium , Three screen capture methods :
1、 Use Application Under class CaptureScreenshot Method .
This method , What is intercepted is the picture of the whole game at a certain frame , Or a full screen shot .
a、 Not for a camera (camera) The picture of , A screenshot .
b、 Screenshot of partial screen , It's not convenient to implement , It's also inefficient , It is not recommended to use... In the project :
although CaptureScreenshot What about this method , Don't do it yourself . But we can take the route of saving the country by curving to realize it . This is the idea : You can use this method to capture a full screen first , Then get the screenshot through the path ; Next, we will use the related graphic classes to , Take a partial area of this screenshot and save it , So you can get a partial screenshot . I will not realize it here , But those who are interested can try , It must be possible .

2、 The method of this second screenshot is , Use Texture2d Class , It can also realize the screenshot function .
Cut a full-screen ( Here's the picture , notes : Yes ui):
CaptureScreenshot2( new Rect( Screen.width*0f, Screen.height*0f, Screen.width*1f, Screen.height*1f));

Cut the middle 4 Divided ( Here's the picture ):
CaptureScreenshot2( new Rect( Screen.width*0.25f, Screen.height*0.25f, Screen.width*0.5f, Screen.height*0.5f));

Here are a few Texture2d Class method , There are also some points to pay attention to in use , See for yourself .
Of course , This method does not need to implement the function of screenshot for a certain camera . But key interfaces have emerged , It is Texture2d.ReadPixels(), Let's not talk about this paragraph , Let's look down !3、 This third method , The best , You can take a screenshot of a certain camera .
In this case , I can cut off , my Avatar What you see in the game scene ,UI Interface ( Use a special camera Show ) What is not supposed to be . Do that , We should separate them into one camera To display ui Interface , With another camera The camera displays the scene picture . then , We only take screenshots of the scene camera . So the key point is : How to take a screenshot of a camera . A new class used here is RenderTexture.
The code is as follows :
I won't say more , Find the relevant information by yourself , Because I don't understand either !
It goes straight to the picture above .
nothing ui Full screen view of :

Only ui Full screen view of :
Yes ui There is a full screen picture of the scene ( Only these two cameras are specified , The relevant tips are in the code “//ps” in ):

Source :http://blog.csdn.net/anyuanlzh/article/details/17008909;
边栏推荐
- Network communication problem locating steps
- Operation of JSON file
- amd锐龙CPU A320系列主板如何安装win7
- 0 basic unity course. Bricklaying
- [notes] unity Scrollview button page turning
- Revit Secondary Development - - Project use Panel features not opened
- Error about the new version of UE4: unavigationsystemv1:: simplemovetoactor has been deprecated
- Unity3d realizes Google Digital Earth
- Nestjs配置静态资源,模板引擎以及Post示例
- Chapter 9 of OpenGL super classic (version 7): fragment processing and frame buffering
猜你喜欢

力扣59. 螺旋矩阵 II

Oracle-数据的基本操作

【VCS+Verdi聯合仿真】~ 以計數器為例

Win10 vs2015 compiling curaengine

Output directory of log files after unity3d packaging
![[learning notes] AssetBundle, xlua, hot update (use steps)](/img/59/9d9f31cfe55a908f2f0705e95ecc05.jpg)
[learning notes] AssetBundle, xlua, hot update (use steps)

Li Kou 2049: count the number of nodes with the highest score

Unity automatic pathfinding

力扣349. 两个数组的交集

Pycharm database tool
随机推荐
pycharm 数据库工具
Intellj idea generates jar packages for projects containing external lib to other projects. The method refers to the jar package written by itself
[recruitment] UE4 Development Engineer
Ripple effect of mouse click (unity & shader)
UE4 method of embedding web pages
Sourcetree usage
Revit二次開發---未打開項目使用面板功能
Unity supports the platform # define instruction of script
Unity application class and data file path
Writing unityshader with sublimetext
Unity scroll view element drag and drop to automatically adsorb centering and card effect
Important knowledge points in unity3d
Initial environment configuration of the list of OpenGL super classic (version 7) vs2019
Unit asynchronous jump progress
Chapter 10 of OpenGL super classic (7th Edition) calculation shader
mmcv常用API介绍
Pycharm database tool
【VCS+Verdi联合仿真】~ 以计数器为例
Database base (Study & review for self use)
Harbor API 2.0 query