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.
Last edited by dengue; Mar 12, 2018 at 06:05 AM.