Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetCRCForAssetBundle(string, out uint)

Extract the CRC checksum for the given AssetBundle.
Read time 1 minuteLast updated 12 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule

GetCRCForAssetBundle(string, uint)

public static bool GetCRCForAssetBundle(string targetPath, out uint crc)

Parameters

targetPath

Asset bundle path.

crc

A resulting checksum of the given asset bundle.

Returns

Type

Description

boolTrue if the method successfully reads the manifest file and extracts the CRC value. False if it cannot find the .manifest file associated to the
targetPath
or fails to parse the CRC value, which might happen due to incorrect paths.

Remarks

A 32-bit checksum is generated during the AssetBundle build process and recorded in the .manifest file and exposed by this method.

Examples

using UnityEngine;using UnityEditor;public class CheckAssetBundleCRCExample{ [MenuItem("Debug/Check AssetBundle CRC")] static public void CheckAssetBundleCRC() { string targetPath = EditorUtility.OpenFilePanel("Pick AssetBundle", "", ""); uint crc; if (targetPath.Length == 0 || !BuildPipeline.GetCRCForAssetBundle(targetPath, out crc)) return; Debug.Log($"AssetBundle {targetPath} has CRC equal to {crc}"); }}