private void UpdateCachedTexture(GITextureType textureType)
        {
            if (isIndexBased)
            {
                if (isRealtimeLightmap)
                {
                    Hash128[] mainHashes = Lightmapping.GetMainSystemHashes();

                    if (!m_RealtimeTextureHash.isValid || !mainHashes.Contains(m_RealtimeTextureHash))
                    {
                        m_RealtimeTextureHash = mainHashes.ElementAtOrDefault(m_LightmapIndex);
                    }
                }
            }
            else // instance based
            {
                if (isRealtimeLightmap)
                {
                    Hash128 systemHash;

                    if (!Lightmapping.GetInputSystemHash(m_InstanceID, out systemHash))
                    {
                        m_CachedTexture.textureAvailability = GITextureAvailability.GITextureNotAvailable;
                        return;
                    }
                    m_RealtimeTextureHash = systemHash;
                }
                else
                {
                    int lightmapIndex;

                    if (!Lightmapping.GetLightmapIndex(m_InstanceID, out lightmapIndex))
                    {
                        m_CachedTexture.textureAvailability = GITextureAvailability.GITextureNotAvailable;
                        return;
                    }

                    m_LightmapIndex = lightmapIndex;
                }
            }

            Hash128 contentHash = isRealtimeLightmap ? LightmapVisualizationUtility.GetRealtimeGITextureHash(m_RealtimeTextureHash, textureType) :
                                  LightmapVisualizationUtility.GetBakedGITextureHash(m_LightmapIndex, m_InstanceID, textureType);

            // if we need to fetch a new texture
            if (m_CachedTexture.texture == null || m_CachedTexture.type != textureType || m_CachedTexture.contentHash != contentHash || m_CachedTexture.contentHash == new Hash128())
            {
                m_CachedTexture = isRealtimeLightmap ?
                                  LightmapVisualizationUtility.GetRealtimeGITexture(m_RealtimeTextureHash, textureType) :
                                  LightmapVisualizationUtility.GetBakedGITexture(m_LightmapIndex, m_InstanceID, textureType);
            }

            if (!m_ShowUVOverlay)
            {
                return; // if we don't wanna show any overlay
            }
            if (m_CachedTexture.texture == null || m_CachedTexture.textureAvailability == GITextureAvailability.GITextureNotAvailable || m_CachedTexture.textureAvailability == GITextureAvailability.GITextureUnknown)
            {
                return; // if we dont have a texture
            }
            // fetch Renderers

            if (isRealtimeLightmap)
            {
                m_CachedTextureObjects = LightmapVisualizationUtility.GetRealtimeGITextureRenderers(m_RealtimeTextureHash);
            }
            else if (LightmapVisualizationUtility.IsAtlasTextureType(textureType))
            {
                m_CachedTextureObjects = LightmapVisualizationUtility.GetBakedGITextureRenderers(m_LightmapIndex);
            }
            else // if it's an instance based baked lightmap, we only have 1 object in it
            {
                m_CachedTextureObjects = new GameObject[] {}
            };
        }