Sprite in ScriptableObject - visible in editor, but not in build

I have this simple ScriptableObject:

[CreateAssetMenu(fileName = "SelectableWidgetData", menuName = "SelectableWidgetData")]
public class SelectableWidgetData : ScriptableObject
{
    public string text = "";
    public Sprite icon;
}

When I try to select Sprite, inspector shows nothing:


I can still lock the scriptable object, manually go to the folder where I have my sprites and drag and drop the sprite onto the field in scriptable object. Then sprite shows correctly when I play in editor, but when I play build, instead of my sprite, I only see white box. How do I fix this? How can I have sprites in scriptable objects, so that they would show correctly in build?

I solved it myself. Here’s what fixed it for me:

I had my SelectableWidgetData class not in SelectableWidgetData.cs file, but in another file. I created SelectableWidgetData.cs file and moved class there. I also stored my scriptable objects inside Scripts folder. I’m not sure if this was also an issue, but I just moved scriptable objects outside Scripts folder and now everything works in build as intended.