Why wont my textures change right?

I’m trying to have a Unity program where I have 5 UI objects and 3 3D objects and take their texture in the script and generate a new texture file with all those and then assign that texture to the objects. I have my 3D objects change texture upon command but they just turn white and my UI objects don’t change at all.

        using UnityEngine;
        using System.Collections;

        public class texture : MonoBehaviour {
	public GameObject[] gameObjects;
	public Texture2D[] textures = new Texture2D[8];

	void Start () {

	}
	
	// Update is called once per frame
	void Update () {
	
	}

	public void ChangeTex()
	{
		Texture2D ctex = new Texture2D (800, 200);

		for(int i = 0; i < 8; i++)
		{
			for(int x = 0; x < textures*.width; x++)*
  •  	{*
    

_ for(int y = 0; y < textures*.height; y++)_
_
{_
_ ctex.SetPixel(x + (100 * i), y, textures.GetPixel (x, y));
}
}
}*_

* foreach (GameObject g in gameObjects) {*
* g.GetComponent().material.mainTexture = ctex;*

* }*
* }*
}

Call ctex.Apply(); to apply changes after you’ve done all SetPixel calls.