当前位置:网站首页>Unity3d:ugui, UI and special effect particle level, bakemesh above 2018.2, particles between two images and in Scrollview
Unity3d:ugui, UI and special effect particle level, bakemesh above 2018.2, particles between two images and in Scrollview
2022-07-23 12:45:00 【Sixi Liyu】
ui The particles shown above generally have two schemes
1. adopt rendertexture Rendering , Can handle hierarchy problems perfectly , But the performance is not good , Multiple cameras
2. Put directly ui Interface adjustment effect sort in layer, But if ui More special effects , The hierarchy is not easy to manage , And more canvas Cause the problem of approval
Now come to the third method, particles BakeMesh( want 2018.2 Above version )
come from Github:https://github.com/mob-sakai/ParticleEffectForUGUI
advantage : Iconicity UGUI You can also adjust the level sorting up and down , Accept Mask Handle
Comparison of various schemes

The particle BakeMesh
principle : Directly let the particle mesh and map in ui Render in the basic components
Use interface
ParticleSystemRenderer.BakeMesh and ParticleSystemRenderer.BakeTrailsMesh Here is the generation grid information
CanvasRenderer.SetMesh
CanvasRenderer.SetTexture
hold mesh and texture Throw to canvasRenderer Rendering
Code parsing
UIParticle
UIParticle Is the parent of the particle
[RequireComponent(typeof(RectTransform))]
[RequireComponent(typeof(CanvasRenderer))]
public class UIParticle : MaskableGraphic
{
protected override void OnEnable()
{
UIParticleUpdater.Register(this);
CanvasRenderer Rendering is included in Canvas Medium UI object , It's a Graphic necessary
UIParticleUpdater
Canvas.willRenderCanvases monitor
internal static class UIParticleUpdater
{
[RuntimeInitializeOnLoadMethod]
private static void InitializeOnLoad()
{
Canvas.willRenderCanvases -= Refresh;
Canvas.willRenderCanvases += Refresh;
}
Q: Canvas.willRenderCanvases monitor
A: Official explanation : At the beginning Canvas Events before rendering .
This allows you to defer processing / Update canvas based elements , Until you're about to start rendering them . Here we do the particle generation Mesh, And then by calling particle.canvasRenderer.SetMesh, Rendered particle mesh
Refresh
private static void Refresh(UIParticle particle)
{
Profiler.BeginSample("[UIParticle] Bake mesh");
BakeMesh(particle);
Profiler.EndSample();
Profiler.BeginSample("[UIParticle] Set mesh to CanvasRenderer");
particle.canvasRenderer.SetMesh(particle.bakedMesh);
Profiler.EndSample();
}

边栏推荐
- Problems encountered in configuring the historical version of detectron
- 冒泡排序,快速排序
- 详解TCP的流量控制机制与拥塞控制机制
- 强一致性和弱一致性的分析思路以及分布式场景的并发技巧
- Unity3d: ugui source, Rebuild Optimization
- unity3d:Assetbundle模拟加载,同步加载,异步加载,依赖包加载,自动标签,AB浏览器,增量打包
- @RequiredArgsConstructor注解使用
- 理解不能的锁们
- 深入解析Redis中的复制
- Hcip--- BGP related configuration
猜你喜欢
随机推荐
Flask项目中创建数据库表db.create_all()
Simply realize the function of stack
ThreadLocal到底在干嘛?
第一类错误离我们有多远
C# 自定义Queue队列集合
记一次日志文件IO系统的设计心得
比较临时的修改node_modules内包的源码并编译引用 修改依赖包
GameFramework:打包资源,打随app发布包,打包生成文件夹说明,上传资源至服务器,下载资源,GameFreamworkList.dat 与GameFrameworkVersion.dat
HCIP---MGRE环境下的OSPF综合实验
@RequiredArgsConstructor注解使用
【数据库】基础理论
C#:stack栈源码,数组栈,链栈
并发编程1-2
读《凤凰架构》- RPC的历史与知识
Unity3d+GameFramework:资源分析,资源依赖,循环依赖检测
C语言:基于顺序表的学生管理系统,超级详细,全部都有注释,看完不懂来扇我。
Implementation of binary tree -c
Explain TCP segmentation and IP fragmentation in detail
C语言数据库:详细的说明用学生管理系统了解数据库的操作,简单易懂。
浅析UDP协议和TCP协议









