fix: memory leak when using AnimatableProperty

3.3.9p1
mob-sakai 2023-05-18 21:29:36 +09:00
parent 2e4d80bc1c
commit c0fba1dc9f
1 changed files with 15 additions and 0 deletions

View File

@ -313,6 +313,20 @@ namespace Coffee.UIExtensions
ClearPreviousMaterials();
}
private void ClearMaterials()
{
// Clear mask materials.
s_PrevMaskMaterials.AddRange(_maskMaterials);
_maskMaterials.Clear();
// Clear modified materials.
s_PrevModifiedMaterials.AddRange(_modifiedMaterials);
_modifiedMaterials.Clear();
canvasRenderer.Clear();
ClearPreviousMaterials();
}
private void ClearPreviousMaterials()
{
foreach (var m in s_PrevMaskMaterials)
@ -447,6 +461,7 @@ namespace Coffee.UIExtensions
_bakedMesh = null;
base.OnDisable();
ClearMaterials();
}
/// <summary>