Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 12th, 2012  |  syntax: C#  |  size: 0.63 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public class MemoryTest : EditorWindow
  2. {
  3.     [MenuItem("Window/MemoryTest")]
  4.     public static void Init()
  5.     {
  6.         GetWindow<MemoryTest>();
  7.     }
  8.  
  9.     private static List<float[,]> Data = new List<float[,]>();
  10.  
  11.     public void OnGUI()
  12.     {
  13.         if(GUILayout.Button("Add"))
  14.             Data.Add(RandomValues());
  15.         if (GUILayout.Button("Clear"))
  16.             Data.Clear();
  17.     }
  18.  
  19.     private float[,] RandomValues()
  20.     {
  21.         var f = new float[5096,5096];
  22.         for(var y = 0; y<512; y++)
  23.             for (var x = 0; x < 512; x++)
  24.                 f[y,x] = Random.Range(0, 1f);
  25.         return f;
  26.     }
  27. }