mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-21 02:12:37 +08:00
close #113; UIEffectCapturedImage: 'Capture on enable' option
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user