Skip to content

Instantly share code, notes, and snippets.

@anchan828
Created February 11, 2012 09:55
Show Gist options
  • Save anchan828/1798348 to your computer and use it in GitHub Desktop.
Save anchan828/1798348 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
public class Script : MonoBehaviour
{
public int w = 100;
private Texture2D tex;
void Update ()
{
tex = new Texture2D (w, w);
Color[] cs = new Color[w * w];
for (int i=0; i<w*w; i++) {
cs [i] = Color.gray * Mathf.PerlinNoise (Random.Range (0f, 1f), Random.Range (0f, 1f));
}
tex.SetPixels (cs);
tex.Apply ();
}
void OnGUI ()
{
GUI.DrawTexture (new Rect (0, 0, Screen.width, Screen.height), tex);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment