- Home /
Import and Material Question
Ok so i need to import .jpg images and apply them as a simple texture to a material, all from a javascript script. My question is, how would i import a .jpg as an asset? I will know the filname, "text1.jpg" ex...
My aim is to take simple .jpgs that i am generating elsewhere and apply them as textures to instantiated game objects.
Thanks for any help, this project is beginning to go beyond my skills.
Answer by efge · Apr 19, 2011 at 09:35 AM
To generate a texture from downloaded data: WWW.texture
To overwrite an existing texture: WWW.LoadImageIntoTexture
To create a new Material and assign a shader and texture: Material
This worked great! Im loading them locally, but it works fine. Thanks
Your answer
Follow this Question
Related Questions
Is it possible to create a Material _asset_ from a script? 3 Answers
Script Compiller errors. need help fixing 1 Answer
How do you change the material of a plane using a C# script? 1 Answer
Disable automatic material creation when importing models 0 Answers
FBX Embedded Normal Map not being assigned to material 0 Answers