static void Duplicate(MenuCommand command) { Module module = (Module)command.context; string folderPath = IOHelpers.GetFolderContainingAsset(module); string path = IOHelpers.GetAvailableAssetPath(folderPath, module.name + ".asset"); Module copiedAsset = module.CopyDeep(); ScriptableObjectHelpers.SaveCompoundScriptableObject(copiedAsset, path); }
static void SaveAsPNG(MenuCommand command) { var module = (MapGenModule)command.context; string folderPath = IOHelpers.GetFolderContainingAsset(module); Texture2D texture = module.Generate().ToTexture(); string name = string.Format("{0}{1}.png", module.name, MapImporter.MAP_SUBSTRING); string texturePath = IOHelpers.GetAvailableAssetPath(folderPath, name); IOHelpers.SaveTextureAsPNG(texture, texturePath); }