feat: maskable option to ignore masking

Close #109
pull/120/head
mob-sakai 2020-10-28 22:19:15 +09:00
parent 3d8f11ba82
commit af5f7e90b0
2 changed files with 16 additions and 0 deletions

View File

@ -25,6 +25,7 @@ namespace Coffee.UIExtensions
private static readonly List<UIParticle> s_TempParents = new List<UIParticle>();
private static readonly List<UIParticle> s_TempChildren = new List<UIParticle>();
private SerializedProperty _spMaskable;
private SerializedProperty _spScale;
private SerializedProperty _spIgnoreCanvasScaler;
private SerializedProperty _spAnimatableProperties;
@ -52,6 +53,7 @@ namespace Coffee.UIExtensions
protected override void OnEnable()
{
base.OnEnable();
_spMaskable = serializedObject.FindProperty("m_Maskable");
_spScale = serializedObject.FindProperty("m_Scale3D");
_spIgnoreCanvasScaler = serializedObject.FindProperty("m_IgnoreCanvasScaler");
_spAnimatableProperties = serializedObject.FindProperty("m_AnimatableProperties");
@ -127,6 +129,9 @@ namespace Coffee.UIExtensions
serializedObject.Update();
// Maskable
EditorGUILayout.PropertyField(_spMaskable);
// IgnoreCanvasScaler
using (var ccs = new EditorGUI.ChangeCheckScope())
{

View File

@ -38,6 +38,11 @@ namespace Coffee.UIExtensions
[Tooltip("Particles")] [SerializeField]
private List<ParticleSystem> m_Particles = new List<ParticleSystem>();
#if !UNITY_2019_4_OR_NEWER
[SerializeField]
private bool m_Maskable = true;
#endif
private bool _shouldBeRemoved;
private DrivenRectTransformTracker _tracker;
private Mesh _bakedMesh;
@ -350,6 +355,9 @@ namespace Coffee.UIExtensions
/// </summary>
protected override void OnEnable()
{
#if !UNITY_2019_4_OR_NEWER
maskable = m_Maskable;
#endif
_cachedPosition = transform.localPosition;
activeMeshIndices.Clear();
@ -440,6 +448,9 @@ namespace Coffee.UIExtensions
SetVerticesDirty();
m_ShouldRecalculateStencil = true;
RecalculateClipping();
#if !UNITY_2019_4_OR_NEWER
maskable = m_Maskable;
#endif
}
void ISerializationCallbackReceiver.OnBeforeSerialize()