当前位置:网站首页>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;
边栏推荐
- Solution to 293 problems in the week of Li Kou
- mmcv常用API介绍
- Chinese pycharm changed to English pycharm
- Operation file file class method
- Nestjs入门和环境搭建
- Pytorch的安装以及入门使用
- Unity3d learning notes-1 (C # learning)
- 力扣59. 螺旋矩阵 II
- Intellj idea generates jar packages for projects containing external lib to other projects. The method refers to the jar package written by itself
- Special folders in unity3d and their meanings
猜你喜欢

【VCS+Verdi联合仿真】~ 以计数器为例

Force buckle 59 Spiral matrix II

Unity lens making

Detailed explanation of the process of "flyingbird" small game (camera adjustment and following part)

力扣589:N 叉树的前序遍历

Unity3d realizes Google Digital Earth

QT connecting external libraries
![[notes] unity Scrollview button page turning](/img/c7/47c4056871d0212ac61524539f0d0e.jpg)
[notes] unity Scrollview button page turning

Unity3d lookat parameter description

Unity C trigonometric function, right triangle corner calculation
随机推荐
Unity automatic pathfinding
On mask culling of unity
Pycharm database tool
pytorch中常用损失函数总结
z-index属性在什么情况下会失效?
Singleton mode in unity
Generate a slice of mesh Foundation
Does the tester need to analyze the cause of the bug?
Unity profiler performance analysis
0 basic unity course. Bricklaying
GoLand No Tests Were Run : 不能使用 fmt.Printf() <BUG>
Chapter 9 of OpenGL super classic (version 7): fragment processing and frame buffering
Win10 vs2015 compiling curaengine
amd锐龙CPU A320系列主板如何安装win7
Unity + hololens2 performance test
The difference between SVG and canvas
Parkour demo
0 foundation starts self-study unit notes control direction becomes larger
Unity scroll view element drag and drop to automatically adsorb centering and card effect
Very nervous. What should I do on the first day of software testing?