I know this question was asked many times, but I still cannot solve it…May I have some suggestions?
What I want to do is to instantiate a prefab from resources folder, but it got “ArgumentException: The Object you want to instantiate is null.” when instantiating.
Here is my codes:
string path = "Prefabs/AnimatedCharacter/" + _theme+"/"+_wordID; print(path); //printed: Prefabs/AnimatedCharacter/attraction/5C71 var animatedWordPrefab = Resources.Load(path) as GameObject; var newWord = GameObject.Instantiate(animatedWordPrefab); //Get error
Target prefab is already placed inside the target folder.
I have no idea why I still getting wrong…
Before the above code, I also use similar method to get the CSV, and it doesn’t get wrong and work well.
string path = "CSV/" + _theme; print(path); TextAsset bookContent = Resources.Load<TextAsset>(path);
I also printed out _theme and _wordID, so I think the problem isn’t related to _theme or _wordID…