本文整理汇总了C#中UnityEditor.SerializedProperty.NextVisible方法的典型用法代码示例。如果您正苦于以下问题:C# SerializedProperty.NextVisible方法的具体用法?C# SerializedProperty.NextVisible怎么用?C# SerializedProperty.NextVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditor.SerializedProperty
的用法示例。
在下文中一共展示了SerializedProperty.NextVisible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnGUI
public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
{
position.height = EditorGUIUtility.singleLineHeight;
property = property.Copy();
property.NextVisible(true);
EditorGUI.PropertyField(position, property);
position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
property.NextVisible(true);
EditorGUI.PropertyField(position, property);
}
示例2: OnGUI
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
drawPrefixLabel = false;
height = 0;
Begin(position, property, label);
position.height = EditorGUI.GetPropertyHeight(property, label, true);
EditorGUI.PropertyField(position, property);
if (property.GetValue() != null)
property.isExpanded = EditorGUI.Foldout(position, property.isExpanded, GUIContent.none);
height += position.height;
position.y += position.height;
if (property.isExpanded && serialized != null)
{
iterator = serialized.GetIterator();
iterator.NextVisible(true);
iterator.NextVisible(true);
EditorGUI.indentLevel += 1;
int currentIndent = EditorGUI.indentLevel;
while (true)
{
position.height = EditorGUI.GetPropertyHeight(iterator, iterator.displayName.ToGUIContent(), false);
height += position.height;
EditorGUI.indentLevel = currentIndent + iterator.depth;
EditorGUI.PropertyField(position, iterator);
position.y += position.height;
if (!iterator.NextVisible(iterator.isExpanded))
{
break;
}
}
EditorGUI.indentLevel = currentIndent;
EditorGUI.indentLevel -= 1;
serialized.ApplyModifiedProperties();
}
End();
}
示例3: CopyPropertyValue
public static void CopyPropertyValue(SerializedProperty source, SerializedProperty dest)
{
source = source.Copy();
dest = dest.Copy();
var destSO = dest.serializedObject;
if (source.hasVisibleChildren)
{
var sourceRoot = source.propertyPath;
var destRoot = dest.propertyPath;
while (source.NextVisible(true) && source.propertyPath.StartsWith(sourceRoot))
{
if (source.propertyType == SerializedPropertyType.Generic)
continue;
var path = destRoot + source.propertyPath.Remove(0, sourceRoot.Length);
var destProperty = destSO.FindProperty(path);
SetPropertyValue(destProperty, GetPropertyValue(source));
}
}
else
{
if (dest.propertyPath == "m_RootOrder")
{
(dest.serializedObject.targetObject as Transform).SetSiblingIndex((int)GetPropertyValue(source));
}
SetPropertyValue(dest, GetPropertyValue(source));
}
}
示例4: InitializeHeight
public void InitializeHeight(SerializedProperty property, GUIContent label)
{
height = EditorGUI.GetPropertyHeight(property, label, true);
if (property.isExpanded && serialized != null)
{
iterator = serialized.GetIterator();
iterator.NextVisible(true);
iterator.NextVisible(true);
while (true)
{
height += EditorGUI.GetPropertyHeight(iterator, iterator.displayName.ToGUIContent(), false);
if (!iterator.NextVisible(iterator.isExpanded))
{
break;
}
}
}
}
示例5: OnGUI
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
drawPrefixLabel = false;
totalHeight = 0;
Begin(position, property, label);
position.height = EditorGUI.GetPropertyHeight(property, label, true);
EditorGUI.PropertyField(position, property);
totalHeight += position.height;
position.y += position.height;
if (property.objectReferenceValue != null) {
serialized = new SerializedObject(property.objectReferenceValue);
iterator = serialized.GetIterator();
iterator.NextVisible(true);
EditorGUI.indentLevel += 1;
int indent = EditorGUI.indentLevel;
while (true) {
position.height = EditorGUI.GetPropertyHeight(iterator, iterator.displayName.ToGUIContent(), false);
totalHeight += position.height;
EditorGUI.indentLevel = indent + iterator.depth;
EditorGUI.PropertyField(position, iterator);
position.y += position.height;
if (!iterator.NextVisible(iterator.isExpanded)) {
break;
}
}
EditorGUI.indentLevel = indent;
EditorGUI.indentLevel -= 1;
serialized.ApplyModifiedProperties();
}
End();
}
示例6: ArrayField
public static void ArrayField(SerializedProperty property)
{
//EditorGUIUtility.LookLikeInspector();
bool wasEnabled = GUI.enabled;
int prevIdentLevel = EditorGUI.indentLevel;
bool childrenAreExpanded = true;
int propertyStartingDepth = property.depth;
while (property.NextVisible(childrenAreExpanded) && propertyStartingDepth < property.depth)
{
childrenAreExpanded = EditorGUILayout.PropertyField(property);
}
EditorGUI.indentLevel = prevIdentLevel;
GUI.enabled = wasEnabled;
}
示例7: PropertyField
void PropertyField (SerializedProperty sp, string name)
{
if (sp.hasChildren) {
GUILayout.BeginVertical();
while (true) {
if (sp.propertyPath != name && !sp.propertyPath.StartsWith (name + "."))
break;
EditorGUI.indentLevel = sp.depth;
bool child = false;
child = sp.depth == 0 ? EditorGUILayout.PropertyField(sp, new GUIContent(dispName)) : EditorGUILayout.PropertyField(sp);
if (!sp.NextVisible (child))
break;
}
EditorGUI.indentLevel = 0;
GUILayout.EndVertical();
} else EditorGUILayout.PropertyField(sp, new GUIContent(dispName));
}
示例8: GenericModuleCopy
//Copy One Module's Values
private void GenericModuleCopy(SerializedProperty ss, SerializedProperty sd, bool depthBreak = true)
{
while(true)
{
//Next Property
if(!ss.NextVisible(true))
{
break;
}
sd.NextVisible(true);
//If end of module: break
if(depthBreak && ss.depth == 0)
{
break;
}
bool found = true;
switch(ss.propertyType)
{
case SerializedPropertyType.Boolean : sd.boolValue = ss.boolValue; break;
case SerializedPropertyType.Integer : sd.intValue = ss.intValue; break;
case SerializedPropertyType.Float : sd.floatValue = ss.floatValue; break;
case SerializedPropertyType.Color : sd.colorValue = ss.colorValue; break;
case SerializedPropertyType.Bounds : sd.boundsValue = ss.boundsValue; break;
case SerializedPropertyType.Enum : sd.enumValueIndex = ss.enumValueIndex; break;
case SerializedPropertyType.ObjectReference : sd.objectReferenceValue = ss.objectReferenceValue; break;
case SerializedPropertyType.Rect : sd.rectValue = ss.rectValue; break;
case SerializedPropertyType.String : sd.stringValue = ss.stringValue; break;
case SerializedPropertyType.Vector2 : sd.vector2Value = ss.vector2Value; break;
case SerializedPropertyType.Vector3 : sd.vector3Value = ss.vector3Value; break;
case SerializedPropertyType.AnimationCurve : sd.animationCurveValue = ss.animationCurveValue; break;
#if !UNITY_3_5
case SerializedPropertyType.Gradient : copyGradient(ss,sd); break;
#endif
default: found = false; break;
}
if(!found)
{
found = true;
switch(ss.type)
{
default: found = false; break;
}
}
}
//Apply Changes
sd.serializedObject.ApplyModifiedProperties();
ss.Dispose();
sd.Dispose();
}
示例9: ArrayGUI
void ArrayGUI (SerializedProperty sp, string name)
{
EditorGUIUtility.LookLikeControls (100.0f, 40.0f);
GUILayout.Space (4.0f);
EditorGUILayout.BeginVertical ("box", GUILayout.MaxWidth(Screen.width));
int i = 0;
int del = -1;
SerializedProperty array = sp.Copy ();
SerializedProperty size = null;
bool first = true;
while (true) {
if (sp.propertyPath != name && !sp.propertyPath.StartsWith (name + "."))
break;
bool child;
EditorGUI.indentLevel = sp.depth;
if (sp.depth == 1 && !first) {
EditorGUILayout.BeginHorizontal ();
if (GUILayout.Button ("", "OL Minus", GUILayout.Width (24.0f)))
del = i;
//GUILayout.Label ("" + i);
child = EditorGUILayout.PropertyField (sp);
GUI.enabled = i > 0;
if (GUILayout.Button (manager.arrowUp, "ButtonLeft", GUILayout.Width (22.0f), GUILayout.Height(18.0f)))
array.MoveArrayElement (i - 1, i);
GUI.enabled = i < array.arraySize - 1;
if (GUILayout.Button(manager.arrowDown, "ButtonRight", GUILayout.Width(22.0f), GUILayout.Height(18.0f)))
array.MoveArrayElement (i + 1, i);
++i;
GUI.enabled = true;
EditorGUILayout.EndHorizontal ();
} else if (sp.depth == 1) {
first = false;
size = sp.Copy ();
EditorGUILayout.BeginHorizontal ();
if (!size.hasMultipleDifferentValues && GUILayout.Button("", "OL Plus", GUILayout.Width(24.0f)))
array.arraySize += 1;
child = EditorGUILayout.PropertyField (sp);
EditorGUILayout.EndHorizontal ();
} else {
child = EditorGUILayout.PropertyField(sp);
}
if (!sp.NextVisible (child))
break;
}
sp.Reset ();
if (del != -1)
array.DeleteArrayElementAtIndex (del);
if (array.isExpanded && !size.hasMultipleDifferentValues) {
EditorGUILayout.BeginHorizontal ();
if (GUILayout.Button("", "OL Plus", GUILayout.Width(24.0f)))
array.arraySize += 1;
GUI.enabled = false;
EditorGUILayout.PropertyField (array.GetArrayElementAtIndex (array.arraySize - 1), new GUIContent ("" + array.arraySize));
GUI.enabled = true;
EditorGUILayout.EndHorizontal ();
}
EditorGUI.indentLevel = 0;
EditorGUILayout.EndVertical ();
EditorGUIUtility.LookLikeControls (170.0f, 80.0f);
}
示例10: IterateSerializedProp
protected void IterateSerializedProp(SerializedProperty property)
{
if (property.NextVisible(true))
{
// Remember depth iteration started from
int depth = property.Copy().depth;
do
{
// If goes deeper than the iteration depth, get out
if (property.depth != depth)
break;
DrawPropertySortableArray(property);
} while (property.NextVisible(false));
}
}
示例11: GetHeight
public float GetHeight(SerializedProperty property, GUIContent label, bool includeChildren)
{
float num = 0f;
if (this.m_DecoratorDrawers != null)
{
foreach (DecoratorDrawer current in this.m_DecoratorDrawers)
{
num += current.GetHeight();
}
}
if (this.propertyDrawer != null)
{
num += this.propertyDrawer.GetPropertyHeightSafe(property.Copy(), label ?? EditorGUIUtility.TempContent(property.displayName));
}
else
{
if (!includeChildren)
{
num += EditorGUI.GetSinglePropertyHeight(property, label);
}
else
{
property = property.Copy();
SerializedProperty endProperty = property.GetEndProperty();
num += EditorGUI.GetSinglePropertyHeight(property, label);
bool enterChildren = property.isExpanded && EditorGUI.HasVisibleChildFields(property);
while (property.NextVisible(enterChildren) && !SerializedProperty.EqualContents(property, endProperty))
{
num += ScriptAttributeUtility.GetHandler(property).GetHeight(property, EditorGUIUtility.TempContent(property.displayName), true);
enterChildren = false;
num += 2f;
}
}
}
return num;
}
示例12: GetHeight
public float GetHeight(SerializedProperty property, GUIContent label, bool includeChildren)
{
float num1 = 0.0f;
if (this.m_DecoratorDrawers != null && !this.isCurrentlyNested)
{
using (List<DecoratorDrawer>.Enumerator enumerator = this.m_DecoratorDrawers.GetEnumerator())
{
while (enumerator.MoveNext())
{
DecoratorDrawer current = enumerator.Current;
num1 += current.GetHeight();
}
}
}
float num2;
if (this.propertyDrawer != null)
num2 = num1 + this.propertyDrawer.GetPropertyHeightSafe(property.Copy(), label ?? EditorGUIUtility.TempContent(property.displayName));
else if (!includeChildren)
{
num2 = num1 + EditorGUI.GetSinglePropertyHeight(property, label);
}
else
{
property = property.Copy();
SerializedProperty endProperty = property.GetEndProperty();
num2 = num1 + EditorGUI.GetSinglePropertyHeight(property, label);
bool enterChildren = property.isExpanded && EditorGUI.HasVisibleChildFields(property);
while (property.NextVisible(enterChildren) && !SerializedProperty.EqualContents(property, endProperty))
{
float num3 = num2 + ScriptAttributeUtility.GetHandler(property).GetHeight(property, EditorGUIUtility.TempContent(property.displayName), true);
enterChildren = false;
num2 = num3 + 2f;
}
}
return num2;
}
示例13: DrawFunctionBlockUI
//.........这里部分代码省略.........
}
else{
GUILayout.Label(functionData.parentBlock.name + " at " +"["+functionData.parentBlock.x + "," + functionData.parentBlock.y + "," + functionData.parentBlock.depth+"]");
//draw the close UI
GUILayout.BeginHorizontal();
GUILayout.Label(functionData.GetType().Name);
GUILayout.FlexibleSpace();
if(GUILayout.Button("X")){
SetEntireMapDirty(functionBlock.blockMap);
functionBlock = null;
functionData = null;
prop= null;
}
GUILayout.EndHorizontal();
GUILayout.Space(10.0f);
fScrollPos = GUILayout.BeginScrollView(fScrollPos);
try{
prop = functionSObj.GetIterator();
if(prop != null && functionSObj != null && functionData != null){
prop.NextVisible(true);
bool searchDeep = true;
do{
searchDeep = true;
if(prop.propertyPath == "m_Script"){
continue;
}
if(prop.name == "parentBlock"){
continue;
}
if(prop.type == "Vector3f"){
searchDeep = false;
}
if(prop.type == "Vector3f" && prop.name == "targetDifference" && currentTidyTarget != null){
prop.vector3Value = currentTidyTarget.targetDifference;
currentTidyTarget = null;
}
if(prop.name == "TidyTarget_parentBlock" && currentTidyTarget != null){
prop.objectReferenceValue = currentTidyTarget.TidyTarget_parentBlock;
}
示例14: DrawArraySize
/// <summary>
/// Draws the size of the array.
/// </summary>
void DrawArraySize( ref Rect position, SerializedProperty property, Object targetObject, string targetPropertyPath, bool openMenu, Vector3 mousePos )
{
property = property.Copy();
property.NextVisible( true );
EditorGUI.PropertyField( position, property );
// Right-Click-Menu.
if( openMenu && position.Contains( mousePos ) )
{ OpenArraySizeFieldMenu( targetObject, targetPropertyPath, mousePos ); }
position.y += EditorGUI.GetPropertyHeight( property );
}
示例15: AddPropsFromArray
private void AddPropsFromArray(PropType type, SerializedProperty props) {
string original = props.propertyPath;
props.Next(true);
props.Next(true);
props.Next(true);
do {
var valueProp = props.FindPropertyRelative("second");
var nameProp = props.FindPropertyRelative("first.name");
string propName = nameProp.stringValue;
AddProperty(propName, type, valueProp);
} while (props.NextVisible(false) && props.propertyPath.Contains(original));
}