Can't Set A Custom Asset Property

So I have the following asset class defined:

[Serializable]
public class PuzzleAsset : ScriptableObject
{
    public byte Width;
    public byte Height;
    public byte Depth;
    public byte Difficulty;
}

I create one using the following code executed from a button click:

private void Save()
{
   var assetFilePath = @"Assets\Puzzle\Assets\" + Mesh.name;
   var asset = ScriptableObject.CreateInstance<PuzzleAsset>();
   asset.name = Mesh.name;
   asset.Width = (byte)Width;
   asset.Height = (byte)Height;
   asset.Depth = (byte)Depth;
   asset.Difficulty = 0;
   AssetDatabase.CreateAsset(asset, assetFilePath);
   AssetDatabase.SaveAssets();
}

This works as there is an asset file created in Unity. My problem is I want to be able to assign one of the assets to a property in another class like so:

public PuzzleAsset Asset;

This field is exposed in the editor but it will not allow me to drag/drop an asset to that property. What am I doing wrong here?

Thanks,
-jeff

Try naming your file something.asset

andymads is correct, Unity checks asset type by file extension, and won’t recognize your puzzle assets as asset objects unless they’re named .asset.

You should also always use GenerateUniqueAssetPath when you’re creating assets unless you specifically want to overwrite assets with the same name at the path.