public override void OnInspectorGUI() { DrawDefaultInspector(); HeatMap script = (HeatMap)target; if (GUILayout.Button("Hide Boxes")) { script.HideBoxes(); } if (GUILayout.Button("Show Boxes")) { script.ShowBoxes(); } if (GUILayout.Button("CreateGrid")) { script.GenerateGrid(); } if (GUILayout.Button("DestroyGrid")) { script.RemoveGrid(); } if (script.IsLoading) { EditorGUILayout.LabelField("Loading:", script.LoadingPercentage.ToString()); SceneView.RepaintAll(); } }
void Start() { AffectorNodeDict = new Dictionary <HeatMapAffector, HeatNode>(); GraphNodeDict = new Dictionary <Vector2, HeatNode>(); if (MainHeatMap == null) { MainHeatMap = this; } foreach (HeatNode node in HeatNode.AllHeatNodes) { GraphNodeDict.Add(new Vector2(node.Collumn, node.Row), node); } foreach (HeatMapAffector affector in HeatMapAffector.AllHeatMapAffectors) { affector.AffectorUpdate += OnAffectorUpdate; affector.AffectorRemoved += OnAffectorRemoved; } HeatMapImage = new Texture2D((Width / Interval) + 1, (Height / Interval) + 1); HeatMapImage.wrapMode = TextureWrapMode.Clamp; if (HeatMapRawImageToReplace) { HeatMapRawImageToReplace.texture = HeatMapImage; } }