本文整理汇总了C#中UnityEditor.SerializedProperty.IsRealArray方法的典型用法代码示例。如果您正苦于以下问题:C# SerializedProperty.IsRealArray方法的具体用法?C# SerializedProperty.IsRealArray怎么用?C# SerializedProperty.IsRealArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditor.SerializedProperty
的用法示例。
在下文中一共展示了SerializedProperty.IsRealArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PropertyField
/// <summary>
/// Displays the property field in the center of the window.
/// This method distinguishes between certain properties.
/// The GameObject tag, for example, shouldn't be displayed with a regular string field.
/// </summary>
/// <param name="p">The SerializedProerty to display</param>
/// <param name="width">The width of the whole thing in the ui</param>
private void PropertyField(SerializedProperty p, float width = 170)
{
if(p.IsRealArray())
{
DisplayArrayProperty(p, width);
}
else
{
var oldValue = p.GetValue();
if(fieldname == "GameObject.TagString")
{
var oldTag = oldValue as string;
var newTag = EditorGUILayout.TagField("", oldTag, GUILayout.Width(width));
if(newTag != oldTag)
{
p.SetValue(newTag);
}
}
else if(fieldname == "GameObject.StaticEditorFlags")
{
DisplayStaticFlagChooser(p, width);
}
else
{
EditorGUILayout.PropertyField(p, new GUIContent(""), GUILayout.Width(width));
}
if(!object.Equals(p.GetValue(), oldValue))
{
p.serializedObject.ApplyModifiedProperties();
UsedNew();
}
}
}
示例2: SerializedValueString
private string SerializedValueString(SerializedProperty p)
{
if(fieldname == "GameObject.StaticEditorFlags")
{
switch(p.intValue)
{
case 0:
return "Not static";
case -1:
return "Static";
default:
return "Mixed static";
}
}
else if(p.IsRealArray())
{
return "Array[" + p.arraySize + "]";
}
return ValueString(p.GetValue());
}
示例3: DifferentValues
/// <summary>
/// Returns true when the two properties have different values, false otherwise.
/// </summary>
private static bool DifferentValues(SerializedProperty ourProperty, SerializedProperty theirProperty)
{
if(!ourProperty.IsRealArray())
{
//Regular single-value property
if(DifferentValuesFlat(ourProperty, theirProperty))
{
return true;
}
}
else
{
//Array property
if(ourProperty.arraySize != theirProperty.arraySize)
{
return true;
}
var op = ourProperty.Copy();
var tp = theirProperty.Copy();
op.Next(true);
op.Next(true);
tp.Next(true);
tp.Next(true);
for(int i = 0; i < ourProperty.arraySize; ++i)
{
op.Next(false);
tp.Next(false);
if(DifferentValuesFlat(op, tp))
{
return true;
}
}
}
return false;
}