CreateAssetMenu not appearing in Create-menu

I’ve made several ScriptableObjects, where instances can be created using the Create submenu in the project. This has worked fine the last three months, but now I don’t get the menu option at all, for any of my scriptable objects. I’ve tried deleting and re-downloading the project, edit the scripts to see if it appears again, changing the name of the object in the create menu, but with no luck.
Is there anyone that have an idea about what could have happened?

This bug is happening to me now too.
Did you ever find a solution?

EDIT: Actually, nevermind, I solved my particular case. I had switched most of my ScriptableObjects to inherit from the same base class, but that base class was accidentally a MonoBehaviour instead of ScriptableObject, so one quick fix there re-enabled them all.

3 Likes

Changing the class from MonoBehavior to ScriptableObject solved it for me.

3 Likes

I was trying to use a scriptable object but when i create it doesn’t appear in unity, its such a strang thing. Some idea how to solve it?
5404842--548760--e4ecbd601d4d74304cb3a3f40fd42823.png

using UnityEngine;

[CreateAssetMenu(fileName = "DungeonGenerationData.asset", menuName = "DungeonGenerationData/Dungeon Data")]
public class DungeonGeneratorData : ScriptableObject {
    public int numberOfCrawlers;
    public int iterationMin;
    public int iterationMax;
}

Hi bros,
@Daxawn : Have you tryed to dont use extention on filename && maybe try to doesnt use space character on name?

 using UnityEngine;
    
[CreateAssetMenu(fileName = "DungeonGenerationData", menuName = "DungeonGenerationData/Dungeon_Data")]
public class DungeonGeneratorData : ScriptableObject {
        public int numberOfCrawlers;
        public int iterationMin;
        public int iterationMax;
}

In the arguments for CreateAssetMenu, fileName is the default name that the newly created instance of the SO should have, not how your file is called that contains the SO definition, such as:
[CreateAssetMenu(fileName = "NewDungeonGenerationData", menuName = "Dungeon Generation/Dungeon Data")]

2 Likes

I tryed to change it but it still doesnt appear the option.
I was thinking that it could be the version, I mean, Im using the 2018.4.13f1 insteed of the new ones. Could it be the problem?
Edit; nope it isnt, im using now the latest version and it still doesnt work. need help

Make sure that your file has the same name as your ScriptableObject definiton. Your project may also not have any other errors [in the console], since they stop Unity from refreshing its menu or something like that.

As for the arguments for the attribute, try using the parameterless attribute first, being [CreateAssetMenu]. Does this show up? It might not show up at the top, but at the very bottom. In the past, experienced some odd behaviors around that, appearently being dependent on your operating system.

I do have two errors on my console but i thnik those are because i havent created the assetmenu yet. I’ll insert u n image.

I also tryed to rename the file and then the name in the code

using System;
using UnityEngine;

[CreateAssetMenu(fileName = "NewDungeonGenerationData", menuName = "DungeonGeneration/DungeonData")]
public class NewDungeonGeneratorData : ScriptableObject {
    public int numberOfCrawlers;
    public int iterationMin;
    public int iterationMax;
}

If cant find solution we can contact by email and ill send u some videos, so it will be easier, if u want of course

Those error messages have to be fixed, because they are related to your problem. Basically, Unity detects that something is wrong, here not finding a type named “NewDungenGenerationData” which you use in DungeonCrawlerController and DungeonGenerator and thus the editor is not “refreshed”, not displaying the data in your list of creating new objects.

Try this one:

    using System;
    using UnityEngine;
 
    [CreateAssetMenu(fileName = "NewDungeonGenerationData", menuName = "DungeonGeneration/DungeonData")]
    public class DungeonGeneratorData : ScriptableObject {
        public int numberOfCrawlers;
        public int iterationMin;
        public int iterationMax;
    }

Make sure that in DungeonCrawlerController and DungeonGenerator, you use “DungeonGeneratData” accordingly and not “NewDungeonGenerationData”.

Again, fileName = "NewDungeonGenerationData" is not the file name of your script containing the defnition of your ScriptableObject. It is the name that new instances of your ScriptableObject have as default name.

Yeah thats the problem. I have been using always DungeonGenerationData and it neither works.

Moreover that errors i think that appear because the scriptable object is missing but i cant create it, so im in a loop.

I think you confuse ScriptableObject definition and ScriptableObject instance. The code that you write in your file, that is your SO definition. Once you create an asset using the asset menu based on your definiton, those are your SO instances.

Look at your error messages. They come from DungeonCrawlerController.cs and DungeonGenerator.cs. These errors prevent you from creating new SO instances, because Unity does not refresh the corresponding menu where the option should appear until your project is error free.

It is hard to tell without the actual files, however, you can open the files in your integrated development environment and it shows you the line and usually marks the error. Just guessing, renaming your SO definition, you did not refactor your code but directly renamed it. In other words, wheresoever you still use the old name of your SO definition, you get an error because the type does not exist anymore since you renamed it.

I tested the SO defintion that I showed in my earlier post and it allows you you to create instances from it using the asset menu.

1 Like

Ok I managed to go on a bit. I managed to create the instance from the asset menu by commenting every line that gave me error but when i create the object it doesn’t detect any script. Look:

Try deleting the SO instance and create a new one. Unity might still be confused. When refactoring your code, such as making name changes, it is a good idea to give Unity a moment until it got everything in order.

Yeah i have already tryed multiple times but it doens’t give any script.
On the other hand the errors are still there n I dont know how to solve them. I think that has been the problem always and not until i solve it anything will work.
Could you tell me any way to solve it?

Just have to jump on this and add I am having the same issue. Have worked for weeks. Made a new code using the same asset menu (copied and pasted it even) and now the entire thing is gone and will not appear no matter what I do.

Do you mean that you have two or more SO definitions that have the same menuName path in the class attribute? That won’t work, you have to give every SO definition with the [CreateAssetMenu] an unique menuName argument. If they are the same path, Unity most likely doesn’t decide which one to display and doesn’t display it at all.

Actually, sorry for being off for awhile, I figured it out. It was something so simple lol

Please share the reason and solution so people who have the same problem can check if it is the same reason for them.

1 Like

I tried replacing the word “filename” with “fileName” and it worked.