CodeSmile AssetDatabase 1.9
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:390
Replacement implementation for Unity's massive AssetDatabase class with a cleaner interface and more ...

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 390 of file Asset.cs.

391 {
392 if (File.Rename(m_AssetPath, newFileName))
393 {
394 SetAssetPathFromObject();
395 return true;
396 }
397
398 return false;
399 }

References Asset.File.Rename().

+ Here is the call graph for this function: