close #113; UIEffectCapturedImage: 'Capture on enable' option

This commit is contained in:
mob-sakai
2018-08-07 15:53:00 +09:00
parent 9a580b2132
commit 65166ecdbd
2 changed files with 17 additions and 0 deletions
@@ -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
{
@@ -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
/// </summary>
public RenderTexture targetTexture { get { return m_TargetTexture; } set { m_TargetTexture = value; } }
/// <summary>
/// This function is called when the object becomes enabled and active.
/// </summary>
protected override void OnEnable()
{
base.OnEnable();
if (m_CaptureOnEnable && Application.isPlaying)
{
Capture();
}
}
/// <summary>
/// This function is called when the MonoBehaviour will be destroyed.
/// </summary>