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


C# SerializedObject.GetIterator方法代码示例

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


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

示例1: FindMissingReferences

	private static void FindMissingReferences(string context, GameObject[] objects)
	{
		foreach (var go in objects)
		{
			var components = go.GetComponents<Component>();

			foreach (var c in components)
			{
				if (!c)
				{
					Debug.LogError("Missing Component in GO: " + FullPath(go), go);
					continue;
				}

				SerializedObject so = new SerializedObject(c);
				var sp = so.GetIterator();

				while (sp.NextVisible(true))
				{
					if (sp.propertyType == SerializedPropertyType.ObjectReference)
					{
						if (sp.objectReferenceValue == null
						    && sp.objectReferenceInstanceIDValue != 0)
						{
							ShowError(context, go, c.GetType().Name, ObjectNames.NicifyVariableName(sp.name));
						}
					}
				}
			}
		}
	}
开发者ID:YaFengYi,项目名称:Unity,代码行数:31,代码来源:MissingReferencesFinder.cs

示例2: App

	void App(GameObject src, GameObject dst)
	{
		dst.transform.localPosition=src.transform.localPosition;
		Component comp=src.GetComponent<MeshFilter>();
		Component dst_comp = dst.AddComponent(comp.GetType());
 
			SerializedObject src_ser_obj = new SerializedObject(comp);
			SerializedObject dst_ser_obj = new SerializedObject(dst_comp);
			src_ser_obj.Update();
			dst_ser_obj.Update();
			SerializedProperty ser_prop = src_ser_obj.GetIterator();
			bool enterChildren = true;
			while (ser_prop.Next(enterChildren)) {
				enterChildren = true;
				string path = ser_prop.propertyPath;
 
				bool skip = false;
				foreach (string blacklisted_path in propertyBlacklist) {
					if (path.EndsWith(blacklisted_path)) {
						skip = true;
						break;
					}
				}
				if (skip) {
					enterChildren = false;
					continue;
				}
 
				//Debug.Log(path);
				SerializedProperty dst_ser_prop = dst_ser_obj.FindProperty(path);
				AssignSerializedProperty(ser_prop, dst_ser_prop);
			}
 
			dst_ser_obj.ApplyModifiedProperties();
	}
开发者ID:saoniankeji,项目名称:JumpJump_Pure,代码行数:35,代码来源:CopyComponents.cs

示例3: LogPropertis

	public static string[] LogPropertis(SerializedObject serObj, string startPropertyName, bool enterChildren)
	{
		if (serObj == null)
			return null;

		string				log = "";
		SerializedProperty	sp;
		bool				bFirst = true;

		if (startPropertyName != null && startPropertyName != "")
			sp = serObj.FindProperty(startPropertyName);
		else sp = serObj.GetIterator();

		while (true)
		{
			object value = GetPropertyValue(sp);
			log += string.Format("{0}{3}{4}{5}   {1,-30}        {2, 20} {6}\r\n", sp.depth, NgConvert.GetTabSpace(sp.depth+1) + sp.name, (value == null ? "null" : value.ToString()), sp.editable, sp.isExpanded, sp.isArray, sp.propertyPath);

			if (sp.Next(bFirst) == false)
				break;
			bFirst = enterChildren;
		}

		{
			log = "=====================================================================\r\n" + log;
			log = log + "=====================================================================\r\n";
			Debug.Log(log);
		}
		return null;
	}
开发者ID:w405229619,项目名称:The-revenge-of-DaNiu,代码行数:30,代码来源:NgSerialized.cs

示例4: createLayer

	static void createLayer(){
		SerializedObject SerializedObjectTagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);
		SerializedProperty it = SerializedObjectTagManager.GetIterator();

		bool showChildren = true;

#if UNITY_5

		while(it.NextVisible (showChildren)){
			Debug.Log(it.displayName);


			if(it.displayName == "Element 8"){
//				it.stringValue = "ShadowLayer";
			}

		}



#else
		while(it.NextVisible (showChildren)){
			
			if(it.name == "User Layer 8"){
//				it.stringValue = "ShadowLayer";
			}
			
		}
		//mmmm
#endif

		SerializedObjectTagManager.ApplyModifiedProperties();

	}
开发者ID:SpacesAdventure,项目名称:Kio-2,代码行数:34,代码来源:TagLayerClass.cs

示例5: SearchMissing

    /// <summary>
    /// 指定アセットにMissingのプロパティがあれば、それをmissingListに追加する
    /// </summary>
    /// <param name="path">Path.</param>
    private static void SearchMissing(string path)
    {
        // 指定パスのアセットを全て取得
        IEnumerable<UnityEngine.Object> assets = AssetDatabase.LoadAllAssetsAtPath (path);

        // 各アセットについて、Missingのプロパティがあるかチェック
        foreach (UnityEngine.Object obj in assets) {
            if (obj == null) {
                continue;
            }
            if (obj.name == "Deprecated EditorExtensionImpl") {
                continue;
            }

            // SerializedObjectを通してアセットのプロパティを取得する
            SerializedObject sobj = new SerializedObject (obj);
            SerializedProperty property = sobj.GetIterator ();

            while (property.Next (true)) {
                // プロパティの種類がオブジェクト(アセット)への参照で、
                // その参照がnullなのにもかかわらず、参照先インスタンスIDが0でないものはMissing状態!
                if (property.propertyType == SerializedPropertyType.ObjectReference &&
                    property.objectReferenceValue == null &&
                    property.objectReferenceInstanceIDValue != 0) {

                    // Missing状態のプロパティリストに追加する
                    missingList.Add (new AssetParameterData () {
                        obj = obj,
                        path = path,
                        property = property
                    });
                }
            }
        }
    }
开发者ID:GotoK,项目名称:H401,代码行数:39,代码来源:MissingListWindow.cs

示例6: DrawInspector

		public static void DrawInspector(Editor wcEditor, System.Type baseType, List<string> ignoreClasses = null) {

			var so = new SerializedObject(wcEditor.targets);
			var target = wcEditor.target;
			
			so.Update();

			var baseTypes = new List<System.Type>();
			var baseTargetType = target.GetType();
			baseTypes.Add(baseTargetType);
			while (baseType != baseTargetType) {

				baseTargetType = baseTargetType.BaseType;
				baseTypes.Add(baseTargetType);

			}
			baseTypes.Reverse();

			SerializedProperty prop = so.GetIterator();
			var result = prop.NextVisible(true);

			EditorGUILayout.PropertyField(prop, false);

			if (result == true) {

				var currentType = EditorUtilitiesEx.FindTypeByProperty(baseTypes, prop);
				EditorGUILayout.BeginVertical();
				{

					while (prop.NextVisible(false) == true) {
						
						var cType = EditorUtilitiesEx.FindTypeByProperty(baseTypes, prop);
						if (cType != currentType) {
							
							currentType = cType;

							var name = cType.Name;
							if (ignoreClasses != null && ignoreClasses.Contains(name) == true) continue;

							EditorUtilitiesEx.DrawSplitter(name);

						}

						EditorGUILayout.PropertyField(prop, true);

					}

					prop.Reset();

				}
				EditorGUILayout.EndVertical();

			}

			so.ApplyModifiedProperties();

		}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:57,代码来源:EditorUtilitiesEx.cs

示例7: GetSerializedProperties

        internal static SerializedProperty[] GetSerializedProperties(this Object go) {
            var so = new SerializedObject(go);
            so.Update();
            var result = new List<SerializedProperty>();

            var iterator = so.GetIterator();
            while (iterator.NextVisible(true)) result.Add(iterator.Copy());
            return result.ToArray();
        }
开发者ID:wsycarlos,项目名称:ARIA,代码行数:9,代码来源:vlbSerialized.cs

示例8: GetProperties

	private IEnumerable<SerializedProperty> GetProperties(SerializedObject obj)
	{
		var iterator = obj.GetIterator();
		var enterChildren = true;
		while (iterator.NextVisible(enterChildren))
		{
			enterChildren = false;
			yield return iterator;
		}
	}
开发者ID:tdmann,项目名称:happycult,代码行数:10,代码来源:CharacterRulePropertyDrawer.cs

示例9: DebugLogAllPropertiesForSerializedProperty

 /// <summary>
 /// Debugs the log all properties for serialized property.
 /// </summary>
 /// <param name='aSerializedObject'>
 /// A serializedproperty.
 /// </param>
 public static void DebugLogAllPropertiesForSerializedProperty(SerializedObject aSerializedObject)
 {
     Debug.Log ("EditorWindowUtility.DebugLogAllPropertiesForSerializedProperty()");
     var property = aSerializedObject.GetIterator();
     var first = true;
     while(property.NextVisible(first))
     {
          first = false;
          Debug.Log("	" + property.name + " = " + property);
     }
 }
开发者ID:kkobsb,项目名称:CodeSamplesPublic,代码行数:17,代码来源:EditorWindowUtility.cs

示例10: copySerialized

    public static void copySerialized(SerializedObject source, SerializedObject dest)
    {
        SerializedProperty serializedPropertyCurrent;

                serializedPropertyCurrent = source.GetIterator ();

                while (serializedPropertyCurrent.Next(true)) {

                        dest.CopyFromSerializedProperty (serializedPropertyCurrent);
                }

                dest.ApplyModifiedProperties ();
    }
开发者ID:osmanzeki,项目名称:bmachine,代码行数:13,代码来源:UnityClipboard.cs

示例11: CopyProperties

            private void CopyProperties(SerializedObject source, Object dest, params SerializedPropertyType[] excludeTypes)
            {
                var newSerializedObject = new SerializedObject(dest);
                var prop = source.GetIterator();
                while (prop.NextVisible(true))
                {
                    if (!excludeTypes.Contains(prop.propertyType))
                    {
                        newSerializedObject.CopyFromSerializedProperty(prop);
                    }
                }

                newSerializedObject.ApplyModifiedProperties();
            }
开发者ID:abstractmachine,项目名称:Fungus-3D-Template,代码行数:14,代码来源:FlowchartWindow.cs

示例12: DrawWindowGUI

    public void DrawWindowGUI(int i)
    {
        EditorGUI.BeginChangeCheck();
        SerializedObject serializedObject = new SerializedObject(this);
        serializedObject.Update();
        SerializedProperty iterator = serializedObject.GetIterator();
        for (bool flag = true; iterator.NextVisible(flag); flag = false)
        {
            EditorGUILayout.PropertyField(iterator, true, new GUILayoutOption[0]);
        }
        serializedObject.ApplyModifiedProperties();
        EditorGUI.EndChangeCheck();

        GUI.DragWindow(new Rect(0, 0, 10000, 20));
    }
开发者ID:Aeal,项目名称:ULib,代码行数:15,代码来源:ComponentNode_Editor.cs

示例13: OnGUI

	void OnGUI()
	{
		GUI.Label(new Rect( 10, 10, 50, 25 ), "Ratio");
		scaleTextValue = GUI.TextField(new Rect( 50, 10, 50, 25 ), scaleTextValue);
		
		float scale = 1.0f;
		float.TryParse(scaleTextValue, out scale);
		
		if( GUI.Button(new Rect(10, 40, 70, 30), "Scale PS") )
		{
			foreach( Object obj in Selection.objects )
			{
				GameObject gameObj = obj as GameObject;
				if( gameObj != null )
				{
					ScalePS(gameObj, scale);
				}				
			}
		}
		
		if( GUI.Button(new Rect(80, 40, 70, 30), "Serz log") )
		{
			foreach( Object obj in Selection.objects )
			{
				GameObject gameObj = obj as GameObject;
				if( gameObj.particleSystem != null )
				{
					SerializedObject so = new SerializedObject(gameObj.particleSystem);
					SerializedProperty it = so.GetIterator();
					while (it.Next(true))
						Debug.Log (it.propertyPath);
						
					break;
				}
				
				LineRenderer lineRenderer = gameObj.GetComponent<LineRenderer>();
				if( lineRenderer != null )
				{
					SerializedObject so = new SerializedObject(lineRenderer);
					SerializedProperty it = so.GetIterator();
					while (it.Next(true))
						Debug.Log (it.propertyPath);
					
					break;
				}
			}
		}
	}
开发者ID:ntchung,项目名称:cosmonova,代码行数:48,代码来源:EffectScaler.cs

示例14: DrawDefaultInspectorExcept

        public static bool DrawDefaultInspectorExcept(SerializedObject serializedObject, params string[] propsNotToDraw)
        {
            if (serializedObject == null) throw new System.ArgumentNullException("serializedObject");

            EditorGUI.BeginChangeCheck();
            var iterator = serializedObject.GetIterator();
            for (bool enterChildren = true; iterator.NextVisible(enterChildren); enterChildren = false)
            {
                if (propsNotToDraw == null || !propsNotToDraw.Contains(iterator.name))
                {
                    //EditorGUILayout.PropertyField(iterator, true);
                    SPEditorGUILayout.PropertyField(iterator, true);
                }
            }
            return EditorGUI.EndChangeCheck();
        }
开发者ID:yuanchunfa,项目名称:spacepuppy-unity-framework,代码行数:16,代码来源:SPEditor.cs

示例15: 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 currentIndent = EditorGUI.indentLevel;

                while (true) {
                    position.height = EditorGUI.GetPropertyHeight(iterator, iterator.displayName.ToGUIContent(), false);

                    totalHeight += 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:Dracir,项目名称:Final-bablititi,代码行数:43,代码来源:ShowPropertiesDrawer.cs


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