private SetPropertyModifications ( Object targetPrefab, |
||
targetPrefab | Object | |
modifications | ||
Результат | void |
public static void OnOverridenPrefabsInspector(GameObject gameObject) { GUI.enabled = true; UnityEngine.Object prefabObject = PrefabUtility.GetPrefabObject(gameObject); if (prefabObject == null) { return; } EditorGUIUtility.labelWidth = 200f; if (PrefabUtility.GetPrefabType(gameObject) == PrefabType.PrefabInstance) { PropertyModification[] propertyModifications = PrefabUtility.GetPropertyModifications(gameObject); if (propertyModifications != null && propertyModifications.Length != 0) { GUI.changed = false; for (int i = 0; i < propertyModifications.Length; i++) { propertyModifications[i].value = EditorGUILayout.TextField(propertyModifications[i].propertyPath, propertyModifications[i].value, new GUILayoutOption[0]); } if (GUI.changed) { PrefabUtility.SetPropertyModifications(gameObject, propertyModifications); } } } PrefabInspector.AddComponentGUI(prefabObject); }
public static void OnOverridenPrefabsInspector(GameObject gameObject) { GUI.enabled = true; var prefab = PrefabUtility.GetPrefabObject(gameObject); if (prefab == null) { return; } EditorGUIUtility.labelWidth = 200; if (PrefabUtility.GetPrefabType(gameObject) == PrefabType.PrefabInstance) { PropertyModification[] modifications = PrefabUtility.GetPropertyModifications(gameObject); if (modifications != null && modifications.Length != 0) { GUI.changed = false; for (int i = 0; i < modifications.Length; i++) { modifications[i].value = EditorGUILayout.TextField(modifications[i].propertyPath, modifications[i].value); } if (GUI.changed) { PrefabUtility.SetPropertyModifications(gameObject, modifications); } } } AddComponentGUI(prefab); }