Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Loading a *.obj file from Resources as TXT

Discussion in 'Getting Started' started by Uwi2k3, Apr 11, 2023.

  1. Uwi2k3

    Uwi2k3

    Joined:
    Mar 7, 2023
    Posts:
    5
    Hello there,

    i am trying to load multiple *.obj files in my unity project as text.
    I have information in the obj files that i need to access.
    But i just cant make it work.

    I have tried somethng like this:
    var tmp_txt = Resources.Load(objFileName) as TextAsset;
    but it won´t work.

    Can you please show me how to do this?

    thnaks!
    kai
     
  2. rdjadu

    rdjadu

    Joined:
    May 9, 2022
    Posts:
    103
    Unity will treat it as a model. One way, just append ".txt" to the file name. Another, put the file in StreamingAssets and load from there.
     
  3. Uwi2k3

    Uwi2k3

    Joined:
    Mar 7, 2023
    Posts:
    5
    He there,

    thanks for the information!