Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Marks98 · Sep 23, 2017 at 02:59 PM · not workingfilenullresources.loadnot found

TextAsset / Resources.load return null

Hi. I searched anywhere but nothing helped me. I have this code for loading different languages using same key in C#.
http://wiki.unity3d.com/index.php?title=TextManager
I have one big problem. When i start the game and try code work, it could'n find any file. Problem is on this line:

TextAsset textAsset = (TextAsset) Resources.Load(fullpath, typeof(TextAsset));

This line always return null. I don't know why. I searched for the same issue but nothing helped me. I found these themes: http://answers.unity3d.com/questions/1017186/textasset-always-returns-null-despite-the-file-exi.html
http://answers.unity3d.com/questions/188284/loading-textasset-returns-null.html
https://forum.unity.com/threads/resources-load-always-returning-null.488281/

To the end. I know, the files must be placed in the Resources folder. I use this method (Resources.Load) in another part of the code and work fine. Thanks all who helped me.

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image WinterboltGames · Sep 23, 2017 at 03:03 PM 0
Share

check the following:

Do you have your resource folder inside your assets folder?

Do you call Destroy() method on the textAsset anywhere in your code?

Double check your files again.

avatar image Marks98 WinterboltGames · Sep 23, 2017 at 03:48 PM 1
Share

Yes. I have my resources folder inside assets. $$anonymous$$ethod Destroy() i don't call nowhere.

avatar image WinterboltGames Marks98 · Sep 23, 2017 at 03:50 PM 0
Share

can I see your fullPath variable?

Show more comments

4 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Marks98 · Sep 25, 2017 at 05:20 PM

Thank all who answered me. I do not know how, but when i changed the code to this: TextAsset textAsset = (TextAsset) Resources.Load ("Languages / en", typeof (TextAsset)); It works. I changed file form .po to .txt. I don't know how is possible is, i did this before several times and it didn't worked. Thanks all.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image sdj110 · Dec 21, 2017 at 04:57 PM 0
Share

YES! just had the same problem for hours and for what ever reason this is the only combination that is actually loading my resource properly.

avatar image
9

Answer by haruna9x · Sep 23, 2017 at 04:16 PM

Did you really find out the problem:

The path is relative to any Resources folder inside the Assets folder of your project, extensions must be omitted.

Source: Resources.Load

Text Assets are a format for imported text files. When you drop a text file into your Project Folder, it will be converted to a Text Asset. The supported text formats are:

.txt

.html

.htm

.xml

.bytes

.json

.csv

.yaml

.fnt

Source: TextAsset

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Marks98 · Sep 23, 2017 at 04:21 PM 0
Share

Yes, i know it. I changed the format of the file from the .po to .txt and doesn't help it me.

avatar image haruna9x Marks98 · Sep 23, 2017 at 04:31 PM 2
Share

Show me the fullpath, because Resources.Load points directly to the Resources folder, so you need to make sure it does not exist in your path. Example This is where you place the file:

 Asset/Resources/$$anonymous$$yAsset /$$anonymous$$yText.txt

You would call this:

  TextAsset textAsset = Resources.Load<TextAsset>("$$anonymous$$yAsset/$$anonymous$$yText");










avatar image Marks98 haruna9x · Sep 23, 2017 at 05:36 PM 0
Share

I use this : Resources.Load("Languages/en.po"); Here is example of my way. alt text It will be probebly correctly.

untitled.png (12.4 kB)
Show more comments
avatar image
1

Answer by losingisfun · Dec 05, 2018 at 11:05 PM

For anyone else having trouble, you may find this helpful.

when importing a simple text file sometimes there is no extension (.txt) and unity wont recognise it as a text asset. To do so, click and edit the file's name to add an extension. An easy indicator of this is the icon that unity displays for the file,

alt text

If they appear like this, they are recognised as text assets, however if they appear as below, they havent been recognised. alt text

I hope this helps!


screen-shot-2018-12-06-at-95853-am.png (25.1 kB)
screen-shot-2018-12-06-at-100223-am.png (20.2 kB)
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image FrankvHoof · Feb 07, 2019 at 05:56 PM 0
Share

Thanks for posting this.. $$anonymous$$ade me realise that OpenOffice was somehow wrecking my .csv files.. Re-saving with a different program instantly fixed the issue I was having..

avatar image
1

Answer by GLeBaTi · May 14, 2019 at 03:15 PM

For anyone else having trouble, you may find this helpful.

  1. remove extension from argument: Resources.Load("MyJsonFileName") //without .json

  2. save file as CRLF (not LF)

  3. save file into folder "Resources"

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image EDevJogos · Jun 09, 2021 at 01:38 AM 0
Share

I was using .txt and had to remove the file extension for some reason too. Thanks.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

78 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Error Script, Not found class GameObject 1 Answer

Can you monitor or profile file I/O from within Unity? 0 Answers

Rendering Image Sprites Programatically 0 Answers

Problem with unity editor,Problem With The Unity Editor 0 Answers

Download "Failed- No File" for Standard Assets and Example 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges