diff --git a/Assets/Coffee/UIExtensions/UIEffect/Scripts/Editor/UIEffectCapturedImageEditor.cs b/Assets/Coffee/UIExtensions/UIEffect/Scripts/Editor/UIEffectCapturedImageEditor.cs
index 6d5b1cc..902a8d8 100644
--- a/Assets/Coffee/UIExtensions/UIEffect/Scripts/Editor/UIEffectCapturedImageEditor.cs
+++ b/Assets/Coffee/UIExtensions/UIEffect/Scripts/Editor/UIEffectCapturedImageEditor.cs
@@ -44,6 +44,7 @@ namespace Coffee.UIExtensions
_spKeepSizeToRootCanvas = serializedObject.FindProperty("m_KeepCanvasSize");
_spTargetTexture = serializedObject.FindProperty("m_TargetTexture");
_spBlurMode = serializedObject.FindProperty("m_BlurMode");
+ _spCaptureOnEnable = serializedObject.FindProperty("m_CaptureOnEnable");
_customAdvancedOption = (qualityMode == QualityMode.Custom) || _spTargetTexture.objectReferenceValue;
@@ -76,6 +77,8 @@ namespace Coffee.UIExtensions
GUILayout.Space(10);
EditorGUILayout.LabelField("Advanced Option", EditorStyles.boldLabel);
+ EditorGUILayout.PropertyField(_spCaptureOnEnable);// CaptureOnEnable.
+
EditorGUI.BeginChangeCheck();
QualityMode quality = qualityMode;
quality = (QualityMode)EditorGUILayout.EnumPopup("Quality Mode", quality);
@@ -165,6 +168,7 @@ namespace Coffee.UIExtensions
SerializedProperty _spIterations;
SerializedProperty _spKeepSizeToRootCanvas;
SerializedProperty _spTargetTexture;
+ SerializedProperty _spCaptureOnEnable;
QualityMode qualityMode
{
diff --git a/Assets/Coffee/UIExtensions/UIEffect/Scripts/UIEffectCapturedImage.cs b/Assets/Coffee/UIExtensions/UIEffect/Scripts/UIEffectCapturedImage.cs
index 85d62eb..3129c72 100644
--- a/Assets/Coffee/UIExtensions/UIEffect/Scripts/UIEffectCapturedImage.cs
+++ b/Assets/Coffee/UIExtensions/UIEffect/Scripts/UIEffectCapturedImage.cs
@@ -50,6 +50,7 @@ namespace Coffee.UIExtensions
[SerializeField][Range(1, 8)] int m_BlurIterations = 1;
[SerializeField] bool m_KeepCanvasSize = true;
[SerializeField] RenderTexture m_TargetTexture;
+ [SerializeField] bool m_CaptureOnEnable = false;
//################################
@@ -131,6 +132,18 @@ namespace Coffee.UIExtensions
///
public RenderTexture targetTexture { get { return m_TargetTexture; } set { m_TargetTexture = value; } }
+ ///
+ /// This function is called when the object becomes enabled and active.
+ ///
+ protected override void OnEnable()
+ {
+ base.OnEnable();
+ if (m_CaptureOnEnable && Application.isPlaying)
+ {
+ Capture();
+ }
+ }
+
///
/// This function is called when the MonoBehaviour will be destroyed.
///