- Home /
The question is answered, right answer was accepted
Unity Custom Inspector - Resources.LoadAll() returns 0 element.
Hello All. I am trying to create an editor tool for easy development for my (kind of) survey about UserExperience about the game. i have a nested structured survey and i want to create an editor tool for managing it.
All my Questions and Selectable Answers are stored as scriptableObject asset in Resources folder.
but when i try to load them from resources it returns "0" element. Here is my code's related part about getting them. can you tell me what i am doing wrong ?
private QuestionScriptableObj[] AllQuestions;
private AnswerScripableObj[] AllAnswers;
private void OnEnable()
{
Debug.Log("Entered");
AllQuestions = Resources.LoadAll<QuestionScriptableObj>("Assets/Resources/QuestionAnswer/Questions");
AllAnswers = Resources.LoadAll<AnswerScripableObj>("Assets/Resources/QuestionAnswer/Answers");
Debug.Log( "AllQuestions " + AllQuestions .Length);
Debug.Log( "AllAnswers " + AllAnswers .Length);
var dene = Resources.LoadAll("Assets/Resources/QuestionAnswer/Questions");
Debug.Log("dene " + dene.Length);
}
All of my debugs Returns "0" .
Note: There are lots of relevant assets in that folders.
EDIT : Check Comments "Answer" is there.
Answer by Dragate · Oct 05, 2017 at 08:49 AM
I think Resources.LoadAll looks directly in Resources Folder. I don't think Asset/Resources/ is needed. For example, instead of
Resources.LoadAll<QuestionScriptableObj>("Assets/Resources/QuestionAnswer/Questions");
do
Resources.LoadAll<QuestionScriptableObj>("QuestionAnswer/Questions");
I'm not sure either, just a suggestion.
Follow this Question
Related Questions
Initialising List array for use in a custom Editor 1 Answer
How can I improve the organization and storing of information for my FPS Character Controller? 0 Answers
Cannot serialize System.Type field 3 Answers
Confused about custom GameObjects,Custom GameObject confusion 0 Answers
Distribute terrain in zones 3 Answers