// Load a .jpg or .png file by adding .txt extensions to the file
// and dragging it on the imageTextAsset
var imageTextAsset : TextAsset;
function Start () {
var tex = new Texture2D (4, 4);
tex.LoadImage(imageTextAsset.bytes);
renderer.material.mainTexture = tex;
}
Since I’m having trouble with actually seeing the mainTexture, I wonder, how exactly do I import the file?
I took a png, changed the extension to “.txt”, imported the txt and dragged it to the imageTextAsset.
Is this the correct procedure to use image asset?
that would actually be a waste of time.
you can just use the image and use it as imageAsset instead.
The textasset approach makes sense if you get the data sent in through TCP for example or if they are stored as byte data only for example as you generated them through an algorithm or because they were part of a much larger image.