Top Question How do I make an array with all Scriptable Objects from a folder in Unity?

K

Kypindor

Guest
So this is the Scriptable Object:

Mã:
[CreateAssetMenu(fileName = "New Char", menuName = "Char")]
public class ScriptableChar : ScriptableObject
{
public string charName;

public Sprite charSprite;
public Sprite charBorderSprite;

public CharClass charClass;
}

And I have tried this to get the array:

Mã:
public Object[] allCharacters = Resources.LoadAll("Cards");

and this:

Mã:
void GetAllCharactersArray()
{
ScriptableChar[] allCharacters = Resources.LoadAll<ScriptableChar>("Cards");
Debug.Log("Characters: "+allCharacters.Length);
}

I have also tried a few other things I have deleted because they haven't worked either.

Image of the Folder structure if that is needed or matters in any way.

I would be really happy if someone can help, I have been trying to solve this for many hours now.

Answer for: "How do I make an array with all Scriptable Objects from a folder in Unity?"...
 
Top