14 private Material mMaterial;
23 Renderer renderer = TargetObject.GetComponent<Renderer>();
26 mMaterial = renderer.material;
30 Debug.LogError(
"CycleTexture requires a renderer and material on the assigned GameObject!");
43 if (index > -1 && index < Array.Length)
45 if (mMaterial != null)
47 mMaterial.SetTexture(
"_MainTex", Array[index]);
65 private void OnDestroy()
67 if (mMaterial != null)
void SetNewArray(Texture[] arr)
Update the current set of textures
override void Awake()
get the material to assign textures to
override void SetIndex(int index)
set the texture
sets the texture of a material based on the selected item in the array