コード例 #1
0
        public static void RenameField(Object context, string oldFieldName, string newFieldName)
        {
            var oldFileName = EditorSerializedFieldUtility.CreatePathName(context, oldFieldName);

            if (!EditorFieldsByFileName.ContainsKey(oldFileName))
            {
                return;
            }

            foreach (var key in EditorFieldsByFileName.Keys.Where(k => k.Contains(oldFileName)).ToArray())
            {
                var newFileName   = EditorSerializedFieldUtility.CreatePathName(context, newFieldName);
                var fixedFileName = key.Replace(oldFileName, newFileName);

                var editorField = EditorFieldsByFileName[key];

                editorField.Rename(fixedFileName);
                EditorFieldsByFileName.Remove(key);
                EditorFieldsByFileName[fixedFileName] = editorField;
            }
        }
コード例 #2
0
 public static EditorSerializedField GetEditorField(Object context, string fieldName) =>
 GetEditorField(EditorSerializedFieldUtility.CreatePathName(context, fieldName));