- Home /
Trouble with Resources.Load
var myText: TextAsset = Resources.Load("Test", TextAsset);
I have made a file called Resources, a text file called Test is inside it, and whenever I run my game, it doesn't seem to assign itself the filename (Test.txt)
I don't want to do this manually cause I want to have different text-files.
What is the right way to do this
Different text files with other filenames? (.txt, .abc, .def)? I dont understand what your are trying todo. Please explain a bit more detailed.
Answer by Vice_Versa · Aug 02, 2015 at 01:14 AM
when you said file im assuming you meant folder. All resources need to be inside of a folder called Resources. In order to use them in game, you need to refer to them in code like this yourObject = Resources.Load("Test", typeof(ObjectType)) as ObjectType;
im guessing you forgot the "as TextAsset" part of it
Your answer
Follow this Question
Related Questions
TextAsset inside the Array - UnityScript/JavaScript 1 Answer
Reading a specific line from a file. 2 Answers
How do I make it so players can't edit the file but the game can? File.CreateText 2 Answers
Problems with writing to a file 0 Answers
How do I access a different material via Javascript? 1 Answer