Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by nickmarty · Jun 05, 2012 at 02:24 AM · runtimeresourcesnullresources.load

Resources.Load returns null in a build, but works in editor

Hello Everyone,

I recently updated my project with a new high res art and I am experiencing a problem now. Resources.Load returns null in a build, but works in editor. I tried builds for Windows and Mac that were built using 3.4.2 and 3.5.2.

When I remove half of art files from Resources folder builds are working perfectly. Also I reimported all assets a couple of times and it didn't help.

It would be great to get some direction or hear your thoughts about this problem. Any help will be appreciated.

Thank you very much,

Nikita

Update #1: Any clues? I would really appreciate some help in here.

Comment
Add comment · Show 8
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 jtbentley · Jun 05, 2012 at 02:26 AM 0
Share

Please show the line of code where you load the resource :)

avatar image nickmarty · Jun 05, 2012 at 02:34 AM 0
Share

For example: Resources.Load ("Images");

avatar image hijinxbassist · Jun 05, 2012 at 02:46 AM 0
Share

Is the actual art named Images and place directly into the Resources folder? Sounds like you want,

 Resources.Load("Images/"+myArtsName);
avatar image nickmarty · Jun 05, 2012 at 03:00 AM 0
Share

"Images" from the line above is an xml file, that's loading in the first place. And it works in the editor. For example I have a test script that executes perfectly in the editor, but doesn't work in a build.

  if (Resources.Load ("Images") != null){
      Debug.Log("Images.xml is loaded! "); // executes in the editor
  }else{
      Debug.LogError("Can't find Images.xml! "); // executes in a build
  }
avatar image jtbentley · Jun 05, 2012 at 03:06 AM 0
Share

Without a valid type, I don't think it's going to understand what extension to use. What happens if you strip the .xml extension prior to build?

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by jtbentley · Jun 05, 2012 at 02:49 AM

You need to define and assign it appropriately.. For instance...

 myMaterial.mainTexture = Resources.Load(("carTextureHires"), Texture2D);

It is fairly well summarised here in the manual

Comment
Add comment · Show 2 · 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 nickmarty · Jun 05, 2012 at 03:04 AM 0
Share

It defined and assigned appropriately because it worked before and when I remove half of art files from Resources folder builds are working perfectly.

If I switch to the previous commit where art files are in a small resolution everything works. I haven't changed anything in the project except replaced art files in Resources folder.

avatar image nickmarty · Jun 05, 2012 at 03:06 AM 0
Share

And it works in the editor right now.

avatar image
0

Answer by R_Gordon · Jan 11, 2017 at 08:59 AM

Very late to the party, but I had the same problem (as in, Textures where depicted properly whilst running from the editor, but where null (not found) when executed from the build) and solved it by copying a separate Assets/Resources folder with the relevant Textures inside to the same location where the executable build was located at (e.g. if your build is at C:\Files\Something then you would also have to copy a version of your Assets/Resources folder there).

Hope this helps.

Comment
Add comment · 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

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

6 People are following this question.

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

Related Questions

Get folder names during runtime within "Resources" package? 1 Answer

resources not loadable in bulid 1 Answer

Do I need to manually call Resources.UnloadUnusedAssets? 0 Answers

About to gut my use of the Resources folder. What are the best practices going forward? 1 Answer

What does Unity actually do when Loading Resources that already exist? 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