1
\$\begingroup\$

Can't seem to find a definitive way to import text to C# in Unity3d. I'm looking to import either a lot of different text files or one large json file to represent all the text in the game.

Thanks for your help

\$\endgroup\$
  • \$\begingroup\$ Are you talking about loading a text file that you have in Unity when you build the game, or are you talking about loading an external file on the user's machine? If the latter, then what platform are you talking about? \$\endgroup\$ – jhocking Jan 26 '15 at 19:53
  • \$\begingroup\$ simply importing text into unity before build \$\endgroup\$ – benbyford Jan 26 '15 at 20:40
1
\$\begingroup\$

The relevant keyword to lookup is TextAsset

When you drag a text file into Unity, it gets treated as a type 'TextAsset'. Actually load the data either by linking it through a serialized variable or by using Resources.Load (just like any other asset: image, prefab, whatever)

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thank you, this answer has pointed me in the right directions \$\endgroup\$ – benbyford Jan 26 '15 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.