# IsNativeAsset

> Checks whether an asset object is a native asset, created by Unity.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/7000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

## IsNativeAsset(Object)

Checks whether an asset object is a native asset, created by Unity.

```csharp
public static bool IsNativeAsset(Object obj)
```

### Parameters

**** (\[Object]\(/engine/7000.0/script-reference/unityengine/object)): The asset object to check.

### Returns

| Type                                                          | Description                                            |
| ------------------------------------------------------------- | ------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the asset is a native asset. Otherwise, false. |

### Remarks

A native asset is a file that Unity's serialization system creates directly, for example a .mat material file. Scenes, prefabs, and assembly definitions aren't native assets. An asset created outside Unity, such as a .png texture file, is a foreign asset. For more information, refer to [Native asset importers reference](/engine/7000.0/manual/assets-and-media/asset-types/assets-supported-types.md) and [AssetDatabase.IsForeignAsset](/engine/7000.0/script-reference/unityeditor/assetdatabase/isforeignasset.md).

### Examples

```csharp
using UnityEditor;
using UnityEngine;

public class AssetDatabaseExamples : MonoBehaviour
{
    [MenuItem("AssetDatabase/List All Native Files")]
    static void ListNativeFiles()
    {
        //List all native assets in the project
        foreach (var guid in AssetDatabase.FindAssets("", new []{"Assets"}))
        {
            var path = AssetDatabase.GUIDToAssetPath(guid);
            var asset = AssetDatabase.LoadMainAssetAtPath(path);
            if(AssetDatabase.IsNativeAsset(asset))
                Debug.Log(asset);
        }
    }
}
```

## IsNativeAsset(EntityId)

Checks whether the asset with the specified EntityId is a native asset, created by Unity.

```csharp
public static bool IsNativeAsset(EntityId entityId)
```

### Parameters

**** (\[EntityId]\(/engine/7000.0/script-reference/unityengine/entityid)): The EntityId of the asset to check.

### Returns

| Type                                                          | Description                                            |
| ------------------------------------------------------------- | ------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the asset is a native asset. Otherwise, false. |

### Remarks

A native asset is a file that Unity's serialization system creates directly, for example a .mat material file. Scenes, prefabs, and assembly definitions aren't native assets. An asset created outside Unity, such as a .png texture file, is a foreign asset. For more information, refer to [Native asset importers reference](/engine/7000.0/manual/assets-and-media/asset-types/assets-supported-types.md) and [AssetDatabase.IsForeignAsset](/engine/7000.0/script-reference/unityeditor/assetdatabase/isforeignasset.md).

## IsNativeAsset(int)

Checks whether the asset with the specified instance ID is a native asset, created by Unity.

> **Warning:**
>
> **Removed.** Please use IsNativeAsset(EntityId) with the EntityId type instead.

```csharp
public static bool IsNativeAsset(int instanceID)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The instance ID of the asset to check.

### Returns

| Type                                                          | Description                                            |
| ------------------------------------------------------------- | ------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the asset is a native asset. Otherwise, false. |

### Remarks

This overload is obsolete. Use the overload that takes an [EntityId](/engine/7000.0/script-reference/unityengine/entityid.md) instead.
