Originally Posted by
dengue
You should format your files to serialize, beyond you dont need to pass bytes, just load the image.
private Texture2D myGUITexture;
void Start()
{
myGUITexture = (Texture2D)Resources.Load("Texturename.png");
}
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
void Start() {
GameObject go = GameObject.CreatePrimitive(PrimitiveType.Plane);
Renderer rend = go.GetComponent<Renderer>();
rend.material.mainTexture = Resources.Load("glass") as Texture;
}
}
a bit sorry for this lazy post,
but read the documentation.
then assign to object.
I guess they transfer to bytes because of the resizing.
There was some kind of reason why I couldn't directly load the image because .tga isn't a supported file format and you need a tga wrapper first
Theoretically I could take the easy way and manually import all item textures, then assign them to objects when they're beeing loaded. That would increase the download size though
EDIT: I looked into it and the reason why I thought I couldn't do it is because the WWW class only supported png and jpg. But I've moved on to simply using System.IO So I think I could just load the tga without a problem...
Last edited by Fluxorious; Mar 12, 2018 at 06:23 AM.