Description
The HasSourceFile
property indicates whether the asset has an associated source file. It returns true
if the asset is backed by a source file and not just a compiled file (e.g., a _c
file). This property is useful for determining if the asset can be edited or needs to be recompiled from its source.
Usage
Use the HasSourceFile
property to check if an asset has a source file before attempting operations that require source access, such as editing or recompiling the asset.
Example
// Example usage of HasSourceFile property
Editor.Asset asset = GetAsset();
if (asset.HasSourceFile)
{
// Perform operations that require a source file
Console.WriteLine("Asset has a source file.");
}
else
{
Console.WriteLine("Asset does not have a source file.");
}