本文整理汇总了C#中UnityEditor.SerializedProperty.GetParent方法的典型用法代码示例。如果您正苦于以下问题:C# SerializedProperty.GetParent方法的具体用法?C# SerializedProperty.GetParent怎么用?C# SerializedProperty.GetParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditor.SerializedProperty
的用法示例。
在下文中一共展示了SerializedProperty.GetParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Begin
public override void Begin(Rect position, SerializedProperty property, GUIContent label)
{
base.Begin(position, property, label);
noFieldLabel = ((CustomAttributeBase)attribute).NoFieldLabel;
noPrefixLabel = ((CustomAttributeBase)attribute).NoPrefixLabel;
noIndex = ((CustomAttributeBase)attribute).NoIndex;
prefixLabel = ((CustomAttributeBase)attribute).PrefixLabel;
disableOnPlay = ((CustomAttributeBase)attribute).DisableOnPlay;
disableOnStop = ((CustomAttributeBase)attribute).DisableOnStop;
scrollbarThreshold = Screen.width - position.width > 19 ? 298 : 313;
indentLevel = EditorGUI.indentLevel;
currentEvent = Event.current;
EditorGUI.BeginDisabledGroup((Application.isPlaying && disableOnPlay) || (!Application.isPlaying && disableOnStop));
if (fieldInfo.FieldType.IsArray) {
index = AttributeUtility.GetIndexFromLabel(label);
arrayProperty = property.GetParent();
if (noIndex) {
if (string.IsNullOrEmpty(prefixLabel)) {
label.text = label.text.Substring(0, label.text.Length - 2);
}
}
else if (!string.IsNullOrEmpty(prefixLabel)) {
prefixLabel += " " + index;
}
}
if (drawPrefixLabel) {
if (!noPrefixLabel) {
if (!string.IsNullOrEmpty(prefixLabel)) {
label.text = prefixLabel;
}
position = EditorGUI.PrefixLabel(position, label);
}
}
else {
if (noPrefixLabel) label.text = "";
else if (!string.IsNullOrEmpty(prefixLabel)) label.text = prefixLabel;
}
currentPosition = position;
currentLabel = label;
}
示例2: Initialize
public override void Initialize(SerializedProperty property, GUIContent label)
{
base.Initialize(property, label);
CustomAttributeBase customAttribute = (CustomAttributeBase)attribute;
noFieldLabel = customAttribute.NoFieldLabel;
noPrefixLabel = customAttribute.NoPrefixLabel;
noIndex = customAttribute.NoIndex;
prefixLabel = customAttribute.PrefixLabel;
disableOnPlay = customAttribute.DisableOnPlay;
disableOnStop = customAttribute.DisableOnStop;
disableBool = customAttribute.DisableBool;
indent = customAttribute.Indent;
beforeSeparator = customAttribute.BeforeSeparator;
afterSeparator = customAttribute.AfterSeparator;
bool inverseBool = false;
if (!string.IsNullOrEmpty(disableBool))
{
inverseBool = disableBool.StartsWith("!");
string boolPath = property.GetParent().FindPropertyRelative(inverseBool ? disableBool.Substring(1) : disableBool).GetAdjustedPath();
boolDisabled = property.serializedObject.targetObject.GetValueFromMemberAtPath<bool>(boolPath);
}
boolDisabled = inverseBool ? !boolDisabled : boolDisabled;
}
示例3: InitializeParameters
void InitializeParameters(SerializedProperty property, GUIContent label)
{
CustomAttributeBase customAttribute = (CustomAttributeBase)attribute;
noFieldLabel = customAttribute.NoFieldLabel;
noPrefixLabel = customAttribute.NoPrefixLabel;
noIndex = customAttribute.NoIndex;
prefixLabel = customAttribute.PrefixLabel;
disableOnPlay = customAttribute.DisableOnPlay;
disableOnStop = customAttribute.DisableOnStop;
disableBool = customAttribute.DisableBool;
indent = customAttribute.Indent;
beforeSeparator = customAttribute.BeforeSeparator;
afterSeparator = customAttribute.AfterSeparator;
isArray = typeof(IList).IsAssignableFrom(fieldInfo.FieldType);
if (isArray) {
index = AttributeUtility.GetIndexFromLabel(label);
arrayProperty = property.GetParent();
}
bool inverseBool = !string.IsNullOrEmpty(disableBool) && disableBool.StartsWith("!");
boolDisabled = !string.IsNullOrEmpty(disableBool) && property.serializedObject.targetObject.GetValueFromMemberAtPath<bool>(inverseBool ? disableBool.Substring(1) : disableBool);
boolDisabled = inverseBool ? !boolDisabled : boolDisabled;
}
示例4: Initialize
public virtual void Initialize(SerializedProperty property, GUIContent label)
{
_initialized = true;
_isArray = typeof(IList).IsAssignableFrom(fieldInfo.FieldType);
_lineHeight = EditorGUIUtility.singleLineHeight;
if (_isArray)
{
_index = AttributeUtility.GetIndexFromLabel(label);
_arrayProperty = property.GetParent();
}
}