close #4; Use Canvas.willRenderCanvases event instead of Update()

pull/33/head
mob-sakai 2018-07-13 12:52:11 +09:00
parent 0cbb376ff6
commit 2a298eea7d
1 changed files with 4 additions and 1 deletions

View File

@ -56,10 +56,13 @@ namespace Coffee.UIExtensions
_mesh.MarkDynamic();
CheckTrail();
base.OnEnable();
Canvas.willRenderCanvases += UpdateMesh;
}
protected override void OnDisable()
{
Canvas.willRenderCanvases -= UpdateMesh;
DestroyImmediate(_mesh);
_mesh = null;
CheckTrail();
@ -76,7 +79,7 @@ namespace Coffee.UIExtensions
Mesh _mesh;
ParticleSystemRenderer _renderer;
void Update()
void UpdateMesh()
{
Profiler.BeginSample("CheckTrail");
CheckTrail();