public static void UpdateBuildingColor(BuildingComplete building)
        {
            string    buildingName = building.name.Replace("Complete", string.Empty);
            SimHashes material     = MaterialHelper.ExtractMaterial(building);

            Color32 color;

            if (State.ConfiguratorState.Enabled)
            {
                switch (State.ConfiguratorState.ColorMode)
                {
                case ColorMode.Json:
                    color = material.GetMaterialColorForType(buildingName);
                    break;

                case ColorMode.DebugColor:
                    color = material.ToDebugColor();
                    break;

                default:
                    color = ColorHelper.DefaultColor;
                    break;
                }
            }
            else
            {
                color = ColorHelper.DefaultColor;
            }

            if (State.TileNames.Contains(buildingName))
            {
                try
                {
                    if (ColorHelper.TileColors == null)
                    {
                        ColorHelper.TileColors = new Color?[Grid.CellCount];
                    }

                    ColorHelper.TileColors[Grid.PosToCell(building.gameObject)] = color;

                    return;
                }
                catch (Exception e)
                {
                    State.Logger.Log("Error while aquiring cell color");
                    State.Logger.Log(e);
                }
            }

            Color32 dimmedColor = color.SetBrightness(color.GetBrightness() / 2);

            // storagelocker
            StorageLocker storageLocker = building.GetComponent <StorageLocker>();

            if (storageLocker != null)
            {
                //SetFilteredStorageColors(storageLocker.filteredStorage, color, dimmedColor);
                SetFilteredStorageColors(storageLocker, (Color)color, (Color)dimmedColor);
            }
            else
            {
                // ownable
                Ownable ownable = building.GetComponent <Ownable>();

                if (ownable != null)
                {
                    //ownable.ownedTint   = color;
                    SetField(ownable, "ownedTint", (Color)color);
                    //ownable.unownedTint = dimmedColor;
                    SetField(ownable, "unownedTint", (Color)dimmedColor);
                    //ownable.UpdateTint();
                    Invoke(ownable, "UpdateTint");
                }
                else
                {
                    // rationbox
                    RationBox rationBox = building.GetComponent <RationBox>();

                    if (rationBox != null)
                    {
                        //SetFilteredStorageColors(rationBox.filteredStorage, color, dimmedColor);
                        SetFilteredStorageColors(rationBox, (Color)color, (Color)dimmedColor);
                    }
                    else
                    {
                        // refrigerator
                        Refrigerator fridge = building.GetComponent <Refrigerator>();

                        if (fridge != null)
                        {
                            //SetFilteredStorageColors(fridge.filteredStorage, color, dimmedColor);
                            SetFilteredStorageColors(fridge, (Color)color, (Color)dimmedColor);
                        }
                        else
                        {
                            // anything else
                            KAnimControllerBase kAnimControllerBase = building.GetComponent <KAnimControllerBase>();

                            if (kAnimControllerBase != null)
                            {
                                kAnimControllerBase.TintColour = color;
                            }
                            else
                            {
                                Debug.LogError(
                                    $"Can't find KAnimControllerBase component in <{buildingName}> and its not a registered tile.");
                            }
                        }
                    }
                }
            }
        }