Description
The FromExtension
method is a static method of the Editor.AssetType
class. It is used to retrieve an AssetType
based on a given file extension. This method is useful for determining the type of asset associated with a specific file extension, allowing for appropriate handling or processing of the asset within the editor environment.
Usage
To use the FromExtension
method, call it statically from the Editor.AssetType
class, passing the file extension as a string parameter. The method will return the corresponding AssetType
if it exists, or null
if no matching asset type is found.
Example
// Example usage of the FromExtension method
string fileExtension = ".vmdl";
Editor.AssetType assetType = Editor.AssetType.FromExtension(fileExtension);
if (assetType != null)
{
Console.WriteLine($"Asset type for extension {fileExtension} is {assetType.FriendlyName}.");
}
else
{
Console.WriteLine($"No asset type found for extension {fileExtension}.");
}