/// <summary>
 /// Gets the selected prefab item from categorizedItem based
 /// on selected Category and selected item by index
 /// </summary>
 /// <param name="index">Index.</param>
 private void GetSelectedPrefabItem(int index = -1)
 {
     if (index != -1)
     {
         PaletteItem item = categorizedItems [selectedCategory] [index];
         //monitor the event
         if (PaletteItemSelectedEvent != null)
         {
             PaletteItemSelectedEvent(item, itemPreview[item]);
         }
     }
 }
 public void Edit(int col, int row)
 {
     // we were general to get to this function, but don't want to handle drag when editing.
     if (targetLevel.IsInsideGridBounds(col, row))
     {
         //in bounds..
         int        cacheIndex = renderedLevelGrid [col] [row];
         LevelPiece validPiece = cacheIndex > -1 ? prefabList [cacheIndex] : null;
         if (validPiece != null)
         {
             paletteItemInspected = prefabList [cacheIndex].GetComponent <PaletteItem> () as PaletteItem;
         }
     }
     else
     {
         paletteItemInspected = null;
     }
     Repaint();
 }
 private void UpdateCurrentPieceInstance(PaletteItem item, Texture2D preview)
 {
     paletteItemSelected = item;
     itemPreview         = preview;
     Repaint();
 }