Created
February 11, 2012 09:55
-
-
Save anchan828/1798348 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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