using System.Collections.Generic; using System.Linq; using UnityEditor; namespace Funique { /// /// The base class for field modifier drawer
/// ------------------------------------------------
/// 欄位修改編輯器的基本類別 ///
public abstract class IfDrawerBase : PropertyDrawer { /// /// Calculate the parent structure and get the target serialized property
/// Absolute to related basically
/// ------------------------------------------------
/// 計算父子結構且抓取目標序列化屬性
/// 基本上, 絕對轉相對 ///
/// Current scope request name /// Current serialized property /// internal SerializedProperty GetPointer(string Target, SerializedProperty p) { List path = p.propertyPath.Split(".".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries).ToList(); if (path.Count >= 2) { path.RemoveAt(path.Count - 1); string aa = string.Join(".", path.ToArray()); aa += "." + Target; SerializedProperty t = p.serializedObject.FindProperty(aa); return t; } else { SerializedProperty t = p.serializedObject.FindProperty(Target); return t; } } } }