mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
Merge branch '3.8' into 4.0-beta
This commit is contained in:
commit
7ee6b78da6
@ -218,6 +218,11 @@ namespace Spine.Unity {
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDestroy () {
|
||||
Clear();
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
public override void Rebuild (CanvasUpdate update) {
|
||||
base.Rebuild(update);
|
||||
if (canvasRenderer.cull) return;
|
||||
@ -458,9 +463,8 @@ namespace Spine.Unity {
|
||||
|
||||
for (int i = 0; i < canvasRenderers.Count; ++i)
|
||||
canvasRenderers[i].Clear();
|
||||
foreach (var mesh in meshes)
|
||||
Destroy(mesh);
|
||||
meshes.Clear();
|
||||
DestroyMeshes();
|
||||
DisposeMeshBuffers();
|
||||
}
|
||||
|
||||
public void TrimRenderers () {
|
||||
@ -562,6 +566,14 @@ namespace Spine.Unity {
|
||||
}
|
||||
}
|
||||
|
||||
protected void DisposeMeshBuffers () {
|
||||
if (meshBuffers != null) {
|
||||
meshBuffers.GetNext().Dispose();
|
||||
meshBuffers.GetNext().Dispose();
|
||||
meshBuffers = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void UpdateMeshSingleCanvasRenderer () {
|
||||
if (canvasRenderers.Count > 0)
|
||||
DisableUnusedCanvasRenderers(usedCount : 0);
|
||||
@ -724,9 +736,22 @@ namespace Spine.Unity {
|
||||
protected void EnsureMeshesCount (int targetCount) {
|
||||
int oldCount = meshes.Count;
|
||||
meshes.EnsureCapacity(targetCount);
|
||||
var meshesItems = meshes.Items;
|
||||
for (int i = oldCount; i < targetCount; i++)
|
||||
if (meshesItems[i] == null) meshesItems[i] = new Mesh();
|
||||
meshes.Add(SpineMesh.NewSkeletonMesh());
|
||||
}
|
||||
|
||||
protected void DestroyMeshes () {
|
||||
foreach (var mesh in meshes) {
|
||||
#if UNITY_EDITOR
|
||||
if (Application.isEditor && !Application.isPlaying)
|
||||
UnityEngine.Object.DestroyImmediate(mesh);
|
||||
else
|
||||
UnityEngine.Object.Destroy(mesh);
|
||||
#else
|
||||
UnityEngine.Object.Destroy(mesh);
|
||||
#endif
|
||||
}
|
||||
meshes.Clear();
|
||||
}
|
||||
|
||||
protected void EnsureSeparatorPartCount () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user