Can't drag scriptable object into serializefield value in inspector

As the title says, I’ve created a scriptable object, but when I try to drag it into a value in the inspector, it doesn’t work. I tried selecting it from the asset menu aswell, and it shows up, but when I click it it still doesn’t show up in the serialized value.

Here’s the code for the scriptable object:

using UnityEngine;

[System.Serializable]
[CreateAssetMenu(fileName = "Lighting Preset", menuName = "Scriptables/Lighting Preset", order = 1)]
public class LightingPreset : ScriptableObject
{
    public Gradient AmbientColor;
    public Gradient DirectionalColor;
    public Gradient fogColor;
}

And here’s the value I’m trying to put it in:

    [SerializeField]
    private LightingPreset preset;

I have no idea why it doesn’t go in. Thanks to anyone who has any advice about this situation.

1 Like

You probably have a compiler error somewhere.

Make sure your log console selector buttons are enabled. See this graphic:

https://discussions.unity.com/t/733002/10

https://discussions.unity.com/t/804947/4

Also worth noting that System.Serializable is unnecessary on Unity objects.

Thanks for the replies guys! I had an error in my code, and when I fixed it the problem went away. I really appreciate your help :slight_smile:

Had a similar issue today but no errors. The solution was to change the folder of the Scriptable Object files to some “TempFolder” then to move them back to the original folder. Something got out of sync but was not Cleanable/Cache-clearable when someone reorganized some files and pushed the changes to Git.

1 Like