CodeSmile AssetDatabase 1.10
Unity's AssetDatabase in enjoyable, consistent, concise, convenient, comprehensible, safe, documented form.
Loading...
Searching...
No Matches

◆ Rename()

Boolean Rename ( String newFileName)

Renames an asset's file name (without extension) or a folder.

Use CodeSmileEditor.Asset.Move if you need to change the file's extension.

Rename file:

Asset asset = new Asset(obj, "Assets/initial name.asset");
asset.Rename("new file name");
Boolean Rename(String newFileName)
Renames an asset's file name (without extension) or a folder.
Definition Asset.cs:394

Rename folder:

Asset asset = new Asset(obj, "Assets/subfloder");
asset.Rename("subfolder");
Parameters
newFileNameThe new name of the file or folder, without extension. Must not be a path.
Returns
True if the rename succeeded. The AssetPath property will be updated accordingly. If false, CodeSmileEditor.Asset.GetLastErrorMessage provides a human-readable failure reason and the AssetPath property remains unchanged.
See also

Definition at line 394 of file Asset.cs.

395 {
396 if (File.Rename(m_AssetPath, newFileName))
397 {
398 SetAssetPathFromObject();
399 return true;
400 }
401
402 return false;
403 }

References Asset.File.Rename().

+ Here is the call graph for this function: