A collection of static methods to help handling various Unity files. Can be used to manage meta files. Usage of some of these methods can break your project. Use this class wisely and backup your project often.
FileInfo of the file in whcih to modify references. Should be an asset file.
oldGuid
string
Current guid reference in the file
newGuid
string
Guid reference that must now be used in the file
oldFileId
string
Current file id reference in the file
newFileId
string
File id reference that must now be used in the file
Return
bool
true file content was replaced; otherwise, false
Description
This should be used to on an asset file to replace the asset referenced in it. Example: you could have a prefab that is using a model X. You could change this reference toward model X for a model Y through usage of this method rather than doing it manually.
MetaGuidRegen
public static GuidRegenResult MetaGuidRegen(string directoryPath);
Parameters
directoryPath
string
Path toward the directory in which meta guid regeneration must be done
Regenerates the guids from all meta files and fixes references in the specified directory and all sub directories. This can be used to create copies of assets.
MetaGuidRegen
public static GuidRegenResult MetaGuidRegen(DirectoryInfo directoryInfo);
Parameters
directoryInfo
DirectoryInfo
DirectoryInfo the directory in which meta guid regeneration must be done
Regenerates the guids from all meta files and fixes references in the specified directory and all sub directories. This can be used to create copies of assets.