---
title: ContentFileIdentity
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/loading/contentfileidentity
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/loading/contentfileidentity.md
last_updated: 2026-11-07
generated_at: 2026-11-09T19:10:19.354Z
locale: en-us
---

# ContentFileIdentity

> Identifies a content file of a content directory build, as listed in LoadedContentFileInfo.Identity.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Loading](/engine/7000.0/script-reference/unity/loading.md)
* **Assembly:** UnityEngine.ContentLoadModule
* **Implements:** [IEquatable\<ContentFileIdentity>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

```csharp
public readonly struct ContentFileIdentity : IEquatable<ContentFileIdentity>
```

## Remarks

A file has the same identity in every [ContentLoadState](/engine/7000.0/script-reference/unity/loading/contentloadstate.md) of its content directory, so compare identities to follow a file from one state to the next. The same asset built into two content directories has the same identity in both.

[ContentFileIdentity.ToString](/engine/7000.0/script-reference/unity/loading/contentfileidentity/tostring.md) returns the file's `StableId` entry in the `ContentLayout.json` file of the build. Use it to find the file in that layout, for example to read the source assets of a file listed in a Player. Compare the string, do not parse it: its format belongs to the layout of the Unity version that made the build.

In the Editor, [ContentLoadEditorUtility.TryGetSourceAssetGUID](/engine/7000.0/script-reference/unityeditor/contentloadeditorutility/trygetsourceassetguid.md) gives the asset that the file was built from.

Additional Resources: [ContentDirectoryLoadInfo.BuildManifestHash](/engine/7000.0/script-reference/unity/loading/contentdirectoryloadinfo/buildmanifesthash.md)

## Examples

```csharp
using System;
using System.Collections.Generic;
using System.IO;
using UnityEditor.Build;
using UnityEngine;

namespace BuildDocExamples
{
    // Example: name the files of a ContentDirectoryLoadInfo that a Player sent back. The Player sends
    // ContentDirectoryLoadInfo.BuildManifestHash and, for each file, ContentFileIdentity.ToString(). In
    // the Editor, the hash finds the build in this project's build history, and each identity is the
    // StableId of one entry of that build's ContentLayout.json file.
    public static class ContentDirectoryLoadInfo_BuildManifestHashExample
    {
        // The parts of ContentLayout.json that this example reads.
        [Serializable]
        class ContentLayout
        {
            public SerializedFile[] SerializedFiles;
        }

        [Serializable]
        class SerializedFile
        {
            public string StableId;
            public string[] SourceAssets;
        }

        public static void LogSourceAssets(Hash128 buildManifestHash, IEnumerable<string> fileIdentities)
        {
            if (!BuildHistory.TryGetBuildSummaryForManifestHash(buildManifestHash, out var summary)
                || !BuildHistory.TryGetFilePath(summary.BuildSessionGUID, "ContentLayout.json", out string layoutPath))
            {
                Debug.LogWarning($"Build {buildManifestHash} is not in this project's build history.");
                return;
            }

            var layout = JsonUtility.FromJson<ContentLayout>(File.ReadAllText(layoutPath));
            var sourceAssets = new Dictionary<string, string[]>();
            foreach (SerializedFile file in layout.SerializedFiles)
                sourceAssets[file.StableId] = file.SourceAssets;

            foreach (string identity in fileIdentities)
            {
                // The paths are the ones the assets had when the content was built.
                string description = sourceAssets.TryGetValue(identity, out string[] assets) && assets.Length > 0
                    ? string.Join(", ", assets)
                    : "no source asset";
                Debug.Log($"{identity}: {description}");
            }
        }
    }
}
```

## Properties

| Property                                                                                | Description                                 |
| --------------------------------------------------------------------------------------- | ------------------------------------------- |
| [IsValid](/engine/7000.0/script-reference/unity/loading/contentfileidentity/isvalid.md) | True if this identity names a content file. |

## Methods

| Method                                                                                    | Description                                                                                         |
| ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| [ToString](/engine/7000.0/script-reference/unity/loading/contentfileidentity/tostring.md) | Returns the `StableId` that the `ContentLayout.json` file of the build lists for this content file. |
