static private void SaveKeys(IList <Item> items, Type keyType, Object target) { var code = EnumGenerator.GetCode(keyType.Namespace, keyType.Name, items.Select(x => x.key)); var path = AssetDatabase.GetAssetPath(target); var pathID = Path.Combine(Path.GetDirectoryName(path), keyType.Name + ".cs"); File.WriteAllText(pathID, code); AssetDatabase.Refresh(ImportAssetOptions.Default); }