// Use this for initialization void Start() { texture = new Texture2D(128, 128,TextureFormat.RGB24,false); style = new GUIStyle(); texture2 = new Texture2D(128, 128,TextureFormat.RGB24,false); style = new GUIStyle(); weapon = GetComponent<Weapon>(); ship = GetComponent<Ship>(); maxHealth = ship.GetHealth(); curHealth = maxHealth; maxCool = weapon.GetcdTime(); curCool = maxCool; for (int y = 0; y < texture.height; ++y) { for (int x = 0; x < texture.width; ++x) { Color color = new Color(238, 0, 238); texture.SetPixel(x, y, color); } } texture.Apply(); for (int y = 0; y < texture2.height; ++y) { for (int x = 0; x < texture2.width; ++x) { Color color = new Color(255, 0, 0); texture2.SetPixel(x, y, color); } } texture2.Apply(); }