ScriptableObject created with missing script

I just loaded up a project and all of the instances of a scriptable object were missing their script link. I tried just adding the script back but that didn’t do anything. So I just deleted them and went about creating new assets. But then I noticed that the new ones still say they’re missing the script. The inspector shows up correctly but where it normally references the script it says it’s missing.

scriptable object code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(menuName = "Interactions/Role")]
public class InteractRole : ScriptableObject
{
    public string Title;
    public Interactions[] CanDo;
}

unity version: 2018.3.0b12 personal

as a side note the other scriptable object seems to be working fine:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(menuName = "Interactions/Interaction")]
public class Interactions : ScriptableObject
{
    public string Verb;
    public Color VerbColor = Color.white;
    public float TimeToPerform = 1f;
}

screenshot of inspector showing what’s happening.
4018702--347389--2018-12-19.png

Try right-clicking your non-working script in the project window and re-import it. Also try closing Unity, deleting the Library folder out of your project, then opening the project to rebuild your library.

Make sure your Meta files are being saved correctly by Unity and not overwritten by another program. If you use source control, it is very important that your Meta files are included.

5 Likes

This happens when the script containing the class derived from ScriptableObject has a filename that does not match the class name. The asset works at runtime but editor functionality like custom editors and being able to duplicate the asset with cmd-d breaks.

13 Likes
   public class TableDataTemplates<T> : SerializedScriptableObject
    {
        [DictionaryDrawerSettings(KeyLabel = "ID", ValueLabel = "Asset", IsReadOnly = true)]
        public Dictionary<int, T> Presets;
    }
    public class SkillTableDataTemplates : TableDataTemplates<SkillShowData>
    {

    }

    public class BuffTableDataTemplates : TableDataTemplates<BuffShowData>
    {

    }

I have the same problem. How to reslove it? How to avoid the None Script to seralize TableDataTemplates?

Are all these classes in the same script file? You can’t do that; they need to be in separate files.

3 Likes