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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Lennon Petrick · Sep 30, 2013 at 02:10 PM · unity-androidassetpath

Texture in the Unity Resouces path doesn't load on Android

I'm developing a game for Android using Unity, and I need load some texture from the Resources path. But this only works in the editor, and when I build the project for Android, the image doesn't load.

My code looks like this:

 public void setTipTextTexture(string texture){ 
     texture = "TipTexts/" + texture; 
     this.tipTexture = Resources.Load(texture) as Texture; 
 }

What am I doing wrong?

Comment
Add comment · Show 3
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 Alex_Furikuri · Jun 24, 2016 at 05:01 AM 0
Share

Hi,

I have the same problem. In unity can see the sprites but i cant see it in android.

The resource load line are these:

 public static string rutaImgTipos = "Images/Tipos/";
 public static string rutaImgTipos2 = "Images/";
 
 public static Sprite imgTipo1  = Resources.Load<Sprite>((rutaImgTipos2+"Tipo1").Trim());

Could someone help me??

Thanks!

avatar image Lennon Petrick Alex_Furikuri · Jun 24, 2016 at 05:45 PM 0
Share

You need to check if the sprints are at the right place in your project

avatar image Alex_Furikuri Alex_Furikuri · Jun 25, 2016 at 07:50 AM 0
Share

Hi,

I solved the problem.

The problem was that in android i cant see a public static Sprite for some reason, but first i put these sprites in a sprite arraylist all works.

I dont understand why the first metod works in unity but no in android...

THAN$$anonymous$$S!

1 Reply

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

Answer by sethuraj · Oct 02, 2013 at 08:09 PM

Your texture should be in a folder named 'Resources' for Resources.Load() to work or else it will work ony in editor not in build.Some thing like this will do.

Texture path - "Assets/Resources/MyTexture"

In code you can avoid the 'Assets' part

 public void setTipTextTexture(string texture)
 {
 texture="TipTexts/"+texture;
 this.tipTexture=(Texture)Resources.Load(texture,typeof(Texture));
 }

Hope this helps!

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 Lennon Petrick · Oct 08, 2013 at 05:28 PM 0
Share

I think don't need put "Resoucers" into code, because when you use the Resouces.Load(), it finds the texture in this folder automatically.

$$anonymous$$y problem was solved, but i didn't know how! Simply I tested again and was already working. However, thank you for help.

avatar image sethuraj · Oct 09, 2013 at 10:44 AM 0
Share

sorry my mistake.No "Resources/" needed.Corrected it.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

16 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

Related Questions

Touch: works on Unity-Remote, doesn't work on Android device after building 2 Answers

KeyNotFoundException: The given key was not present in the dictionary. 1 Answer

How to extend Activity (Android)? 1 Answer

How to assign a GUISkin using code only? 1 Answer

How to set Android keyboard to capitalize each word 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