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


C# SerializedProperty.Reset方法代码示例

本文整理汇总了C#中UnityEditor.SerializedProperty.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# SerializedProperty.Reset方法的具体用法?C# SerializedProperty.Reset怎么用?C# SerializedProperty.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEditor.SerializedProperty的用法示例。


在下文中一共展示了SerializedProperty.Reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawFunctionBlockUI


//.........这里部分代码省略.........
							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;
								
							}
							
							if(prop.type == "TidyTarget"){
																	
								EditorGUILayout.BeginHorizontal();
							
								GUILayout.Label(prop.name + ":");
								
								GUILayout.FlexibleSpace();
								
								Color gc = GUI.color;
								
								if(setTidyTarget == true){
									GUI.color = Color.green;
								}
								
								if(GUILayout.Button("Set")){
									setTidyTarget = true;
									//tidyTargetName = prop.name;
									currentTidyTarget = null;
								}
								
								GUI.color = gc;
								
								EditorGUILayout.EndHorizontal();
								
								continue;
							}
						
							EditorGUILayout.BeginHorizontal();
							EditorGUILayout.PropertyField(prop);
							
							EditorGUILayout.EndHorizontal();
							
						}while(prop.NextVisible(searchDeep));
						
						prop.Reset();
						
						functionSObj.ApplyModifiedProperties();	
						
						functionSObj.Update();
					}
					else{
						GUILayout.Label("Data null.");
					}
					
				}catch(Exception e){Debug.LogWarning(e.ToString());}
					
				GUILayout.EndScrollView();
				
				GUILayout.BeginHorizontal();
				
				GUILayout.FlexibleSpace();
				
				if(GUILayout.Button("Delete")){
					
					TidyFunctionalObject o = functionBlock.blockMap.functionalOverlay.RemoveDataAt(functionBlock.x,functionBlock.y,functionBlock.depth);
					
					GameObject.DestroyImmediate(o);
					
					functionData = null;
					prop = null;
										
					SetEntireMapDirty(functionBlock.blockMap);
					
					functionBlock = null;
				}
				
				GUILayout.EndHorizontal();
			}
						
			GUILayout.EndVertical();
				
			GUILayout.EndArea();
			
			Handles.EndGUI();
		}
开发者ID:moderndelta137,项目名称:Shadow_Sword,代码行数:101,代码来源:TidyMapCreator.cs

示例2: 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


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