Search Unity

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:
    115
    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!