| Parameter | Description |
|---|---|
| obj | The asset object to check. |
bool True if the asset is a foreign asset. Otherwise, false.
Checks whether an asset object is a foreign asset, created outside Unity.
A foreign asset is an asset that wasn't created in Unity, for example a .png texture file. During import, Unity creates a serialized representation of a foreign asset in the Library folder of the project. This happens when you first add the asset, when it changes outside Unity, and when you change its import settings. An asset that Unity creates, such as a material, is a native asset. For more information, refer to Native asset importers reference and AssetDatabase.IsNativeAsset.
using UnityEditor; using UnityEngine;
public class AssetDatabaseExamples : MonoBehaviour { [MenuItem("AssetDatabase/Find Foreign Assets")] static void FindForeignAssets() { //Find all foreign assets foreach (var guid in AssetDatabase.FindAssets("",new []{"Assets"})) { var path = AssetDatabase.GUIDToAssetPath(guid); var asset = AssetDatabase.LoadMainAssetAtPath(path); var assetIsForeign = AssetDatabase.IsForeignAsset(asset); if(assetIsForeign) Debug.Log(asset); } } }
| Parameter | Description |
|---|---|
| entityId | The EntityId of the asset to check. |
bool True if the asset is a foreign asset. Otherwise, false.
Checks whether the asset with the specified EntityId is a foreign asset, created outside Unity.
A foreign asset is an asset that wasn't created in Unity, for example a .png texture file. During import, Unity creates a serialized representation of a foreign asset in the Library folder of the project. This happens when you first add the asset, when it changes outside Unity, and when you change its import settings. An asset that Unity creates, such as a material, is a native asset. For more information, refer to Native asset importers reference and AssetDatabase.IsNativeAsset.
| Parameter | Description |
|---|---|
| instanceID | The instance ID of the asset to check. |
bool True if the asset is a foreign asset. Otherwise, false.
Checks whether the asset with the specified instance ID is a foreign asset, created outside Unity.
This overload is obsolete. Use the overload that takes an EntityId instead.