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\$
2
  • \$\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, 2015 at 19:53
  • \$\begingroup\$ simply importing text into unity before build \$\endgroup\$
    – benbyford
    Jan 26, 2015 at 20:40

1 Answer 1

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)

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .