3
« on: May 05, 2014, 01:55:23 AM »
I would like to create a texture array using the UITexture prefab provided with NGUI however; it's not working out. I am unfamiliar with c# and created a script using javascript that creates an array in the inspector but nothing happens.
The idea is that upon the start of the scene I would like to generate a random texture 0-31.
here is my code so far.
#pragma strict
var itemTextures : Texture[];
function Start () {
renderer.material.mainTexture = itemTextures[Random.Range(0, 31)];
}
The texture array appears in the inspector I assign textures to all the elements 0-31 but nothing happens when I click play. I attached Mesh Renderer as I was getting compiler errors asking for that. No compiler errors but nothing happens. No textures are showing up just blank screen.
Please help. Pardon for I am a noob at programming. =(