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 Dunkhan · Jan 17, 2011 at 01:36 AM · textureimageruntimeload

my textures aren't working (bmp files issue)

I know there are a number of similar questions but I have read all the ones I could find and none of the answers have helped. I am trying to load objects from a .x file and then load a texture from a .bmp file (the texture format is not important I can easily change if .bmps don't work). The models are loading correctly and I am adding some texture coords from the file. The models weren't textured in the 3d program I made them in though so the problem could be here. Anyway the end result that the models are all just white. The texture isn't showing up. Here is what I am doing:

var image = new WWW(imagePath);
yield image;
image.LoadImageIntoTexture(currentObject.renderer.material.mainTexture);

As you can probably see the code is pretty standard and basically just copied from the docs. I get no errors at any point during the process of loading object and texture. I am out of ideas.

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 3dDude · Jan 17, 2011 at 02:10 AM 0
Share

This might sound stupid. But is it necessary to load the texture through scripting? why not just import it in editor?

avatar image Justin Warner · Jan 17, 2011 at 02:19 AM 0
Share

Some people like having the ability of uploading your own textures in game, maybe a car color/graphic... However, it is possible.

avatar image Dunkhan · Jan 17, 2011 at 03:10 AM 0
Share

as I mentioned above I am loading entire user objects at runtime. The main concept of my game relies on users being able to load their own content just by dropping files in certain game folders.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Justin Warner · Jan 17, 2011 at 02:20 AM

// Get the latest webcam shot from outside "Friday's" in Times Square var url = "http://images.earthcam.com/ec_metros/ourcams/fridays.jpg"; function Start () { // Start a download of the given URL var www : WWW = new WWW (url);

 // Wait for download to complete
 yield www;

 // assign texture
 renderer.material.mainTexture = www.texture; 

}

This is fromt he API, it takes the image at that URL, and downloads, and makes it a texture...

I'd suggest doing it after this example.

http://unity3d.com/support/documentation/ScriptReference/WWW.html

Comment
Add comment · Show 10 · 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 Dunkhan · Jan 17, 2011 at 02:38 AM 0
Share

That was the first code I copied, the one I posted was the second method I tried. Both return blank white objects.

avatar image Justin Warner · Jan 17, 2011 at 03:21 AM 0
Share

Do you at least get an image by using this? Like, does one appear in the hierarchy?

avatar image Dunkhan · Jan 17, 2011 at 01:36 PM 0
Share

actually yes, the object appears to have a texture with a red question mark (?) on a white background this explains why the colour was white and means that the texture coordinates aren't set very well. I assume this is a some default error texture from unity. Anyone know what causes it to show up?

avatar image Justin Warner · Jan 17, 2011 at 06:10 PM 0
Share

Default texture in Unity is bright pink I believe... Are you downloading a small texture or a large texture, because maybe question mark is like, just it hasn't downloaded, so it displays that, I seriously don't know... Sorry.

avatar image Dunkhan · Jan 17, 2011 at 08:15 PM 0
Share

I am opening the image from my own hard disk, it is fairly large, 256x256 pixels, but hard disk reading that should only take milliseconds

Show more comments
avatar image
0

Answer by Dunkhan · Apr 11, 2012 at 06:18 AM

I just noticed that this has 1000 views and the answer is not really even here. the answer was .BMP is not a valid file type for www images. If you are having troubles that do not involve .bmp files then I apologise for wording the questions so generally. I have added a note to the title so that people with a million different problems don't all end clicking on this and being disappointed that it doesn't help.

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

1 Person is following this question.

avatar image

Related Questions

Loading 8192x8192 textures at runtime on android 0 Answers

Can I load Textures outside the resources folder? 1 Answer

Load a jpeg from the users drive to use as a texture in a standalone build? 1 Answer

Loading user custom image. 2 Answers

Best way to speed up loading texture from file 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