Im trying to apply a simple texture to a Gameobject (plane) that i have created during runtime. Im choosing a simple jpeg image stored in my "Resources" folder, loading it and trying to apply it as a texture.
Heres the following code snippet in my Gameobject class:
Texture2D staticTex = (Texture2D)Resources.Load("test");
Debug.Log("ULog Texture Size Width " + staticTex.width + "ULog texture Size Height " + staticTex.height);
MeshRenderer renderer = plane.AddComponent(typeof(MeshRenderer)) as MeshRenderer;
renderer.material.mainTexture = staticTex;
This works fine on the editor, but i get a pink texture on the iPhone.
Im using:
Unity : 5.5.0f3
Xcode : 8.0
iOS : 10.0.2
This used to work as expected in previous builds but has just stopped working now.
I have tried:
1. Clearing the GI cache
2. Making sure shaders are included by adding a test shader.
Not sure what is going wrong, or what has changed. Any help is appreciated!
↧