当前位置: 首页>>代码示例>>C#>>正文


C# SerializedProperty.NextVisible方法代码示例

本文整理汇总了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);
	}
开发者ID:claudia-gp,项目名称:oblivious-oscar,代码行数:10,代码来源:CustomClassPropertySetterExampleEditor.cs

示例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();
        }
开发者ID:Magicolo,项目名称:PseudoFramework,代码行数:51,代码来源:ShowPropertiesDrawer.cs

示例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));
			}
		}
开发者ID:Zammy,项目名称:ProjectSpaceship,代码行数:32,代码来源:PEPropertyHelper.cs

示例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;
                    }
                }
            }
        }
开发者ID:Magicolo,项目名称:PseudoFramework,代码行数:21,代码来源:ShowPropertiesDrawer.cs

示例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();
        }
开发者ID:Dracir,项目名称:Tarata-tesseract,代码行数:40,代码来源:ShowPropertiesDrawer.cs

示例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;
    }
开发者ID:meta-42,项目名称:uEasyKit,代码行数:16,代码来源:EditorGUIExtension.cs

示例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));
	}
开发者ID:keplergames,项目名称:TowerDefence2D,代码行数:21,代码来源:InspectorPlus.cs

示例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();
	}
开发者ID:kkiniaes,项目名称:Fire-On-Ice,代码行数:58,代码来源:CFXEasyEditor.cs

示例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);
	}
开发者ID:keplergames,项目名称:TowerDefence2D,代码行数:86,代码来源:InspectorPlus.cs

示例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));
            }
        }
开发者ID:ChemiKhazi,项目名称:UnityToolbag,代码行数:16,代码来源:SortableArrayInspector.cs

示例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;
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:36,代码来源:PropertyHandler.cs

示例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;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:36,代码来源:PropertyHandler.cs

示例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;
								
							}
							
开发者ID:moderndelta137,项目名称:Shadow_Sword,代码行数:66,代码来源:TidyMapCreator.cs

示例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 );
    }
开发者ID:KurataKazuaki,项目名称:Unity-SmartArrayPropertyDrawer,代码行数:15,代码来源:SmartArrayPropertyDrawer.cs

示例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));
	}
开发者ID:jharger,项目名称:globalgamejam2016,代码行数:18,代码来源:AlloyInspectorBase.cs


注:本文中的UnityEditor.SerializedProperty.NextVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。