Cleanup and ensuring the UIParticleSystem is disposed on Destroy correctly.

Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/412
development
Simon Jackson 2023-01-03 11:42:22 +00:00
parent 60eed9b87a
commit 12f6174469
6 changed files with 149 additions and 146 deletions

View File

@ -6,8 +6,8 @@ namespace UnityEngine.UI.Extensions.ColorPicker
{ {
[RequireComponent(typeof(Text))] [RequireComponent(typeof(Text))]
public class ColorLabel : MonoBehaviour public class ColorLabel : MonoBehaviour
{ {
public ColorPickerControl picker; public ColorPickerControl picker;
public ColorValues type; public ColorValues type;
@ -83,5 +83,5 @@ public class ColorLabel : MonoBehaviour
else else
return Mathf.FloorToInt(value).ToString(); return Mathf.FloorToInt(value).ToString();
} }
} }
} }

View File

@ -59,8 +59,10 @@ namespace UnityEngine.UI.Extensions.ColorPicker
private void OnDestroy() private void OnDestroy()
{ {
if (image.texture != null) if (image.texture != null)
{
DestroyImmediate(image.texture); DestroyImmediate(image.texture);
} }
}
#if UNITY_EDITOR #if UNITY_EDITOR
private void OnValidate() private void OnValidate()

View File

@ -7,8 +7,8 @@ namespace UnityEngine.UI.Extensions.ColorPicker
{ {
[RequireComponent(typeof(InputField))] [RequireComponent(typeof(InputField))]
public class HexColorField : MonoBehaviour public class HexColorField : MonoBehaviour
{ {
public ColorPickerControl ColorPicker; public ColorPickerControl ColorPicker;
public bool displayAlpha; public bool displayAlpha;
@ -97,5 +97,5 @@ public class HexColorField : MonoBehaviour
return false; return false;
} }
} }
} }
} }

View File

@ -52,8 +52,10 @@ namespace UnityEngine.UI.Extensions.ColorPicker
private void OnDestroy() private void OnDestroy()
{ {
if (image.texture != null) if (image.texture != null)
{
DestroyImmediate(image.texture); DestroyImmediate(image.texture);
} }
}
#if UNITY_EDITOR #if UNITY_EDITOR
private void OnValidate() private void OnValidate()

View File

@ -96,10 +96,8 @@ namespace UnityEngine.UI.Extensions
{ {
effectRoot.SetActive(true); effectRoot.SetActive(true);
} }
{ }
}
}
void OnDestroy() void OnDestroy()
{ {
if (!Application.isPlaying) if (!Application.isPlaying)

View File

@ -388,6 +388,7 @@ namespace UnityEngine.UI.Extensions
{ {
currentMaterial = null; currentMaterial = null;
currentTexture = null; currentTexture = null;
base.OnDestroy();
} }
public void StartParticleEmission() public void StartParticleEmission()