Search Unity

Question LoadAssetAtPath can't load TextAsset

Discussion in 'Asset Bundles' started by amengGG, Jan 28, 2021.

  1. amengGG

    amengGG

    Joined:
    Oct 19, 2018
    Posts:
    1
    it's my asset,
    upload_2021-1-28_17-17-16.png


    first,i load it with the Application.streamingAssetsPath
    upload_2021-1-28_17-16-21.png

    get wrong:
    upload_2021-1-28_17-17-42.png

    then, i load it with the relative path,
    upload_2021-1-28_17-18-19.png
    get wrong:
    upload_2021-1-28_17-18-39.png


    so, how can i load it correct, thanks for your help
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    StreamingAssets is a special directory where files are put in raw form. If you want TextAsset, you have to put the asset file elsewhere.
     
  3. mahdi_jeddi

    mahdi_jeddi

    Joined:
    Jul 18, 2016
    Posts:
    246
    In this case you probably want to put a normal text file in StreamingAssets folder and load it using StreamReader or some other standard .NET IO classes.