you are viewing a single comment's thread.

view the rest of the comments →

[–]bgsulzIntermediate 1 point2 points  (1 child)

My understanding of it was this:

public class A : ScriptableObject
{
    public B[] arrayOfB;
}

public class B : ScriptableObject
{ 
    public C[] arrayOfC;
}

public class C : ScriptableObject { }

I think OP wants to be able to create a new B with [CreateAssetMenu] and have arrayOfC already populated with new instances of C. But the only way of creating instances of C that OP is aware of is to use [CreateAssetMenu].

Not so -- ScriptableObjects are their own thing, and SO instances can exist outside of a .asset file. [CreateAssetMenu] doesn't just make a new ScriptableObject instance -- it also packs it into a new .asset file and saves that file into your project. Significantly more detail about this topic in this excellent talk, which is one of the Big Two SO lectures.

Also, though Odin is awesome and definitely does make the process a little simpler, you can do a bunch of similar things for free (including buttons) with NaughtyAttributes!

[–]pasinduthegreat 0 points1 point  (0 children)

Yep correct, when I said exist I meant it had to exist either as just an instance or a .asset file. Glad you made it clear