Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

[Help] Loading Text Resources?

Discussion in 'Project Tiny' started by boringName, May 1, 2019.

  1. boringName

    boringName

    Joined:
    Jul 20, 2016
    Posts:
    8
    Goal: I'd like to store a text file containing game dialog inside a unity tiny project, then at runtime load that text file inside a script and read its contents as a string.

    Problem: I can't find any documentation on how to do so.

    Question: Is it possible to do this? If so, how?

    Note: If I'm unable to do this, its fine. I can mimic the functionality I need by tossing the entire text file into a system script as a function that returns a string, and access the data that way. That said, it feels... inelegant? To do so. I'd rather just load a resource.

    Thanks for your advice in advance!
     
  2. Rupture13

    Rupture13

    Joined:
    Apr 12, 2016
    Posts:
    131
    You can use regular JavaScript (or even import libraries... there's another thread for that somewhere) to read the file. You could then store the contents of that file in either the window or a html element, which you can then read from within Tiny systems.
     
    boringName likes this.