Shader.SetGlobalTexture does not seem to work

This works (yay!)

void Update(){
            gameTime += Time.deltaTime;
            heatStage = (Mathf.Cos(gameTime / yearLengthDiv_PiMul2) + 1f) / 2f;
            Shader.SetGlobalFloat("heatStage", heatStage);
}

This works

        Texture2D hotMapTexture2D = TextureGenerator.TextureFromHeightMap(hotMap);
        hotMapTexture2D.Apply();
        meshRenderer.material.SetTexture("hotMap", hotMapTexture2D);

So to do some really tricky stuff, I want this to work, but it doesn’t:

        Texture2D hotMapTexture2D = TextureGenerator.TextureFromHeightMap(hotMap);
        hotMapTexture2D.Apply();
        Shader.SetGlobalTexture("hotMap", hotMapTexture2D);

the texture appears to come in all 0.

I have unexposed the property in shader graph.
I noticed this makes the “Mode” unavailable for this node in shadergraph.

I tried

        Texture2D hotMapTexture2D = TextureGenerator.TextureFromHeightMap(hotMap);
        hotMapTexture2D.Apply();
        var uerrtsec = UnityEngine.Rendering.RenderTextureSubElement.Color;
        Shader.SetGlobalTexture("hotMap", hotMapTexture2D, uerrtsec);

and the four different variants of RenderTextureSubElement, but that seems to require a “rendertexture” and not a texture2D.

“hotmap” is really just a map of floats between 0 and 1, so perhaps I can convert it so some other type of texture, and then SetGlobalTexture?

I figured this out.
To set a global texture in your code you can assign texture2d as a texture, as such:

        Texture texture = texture2D;
        Shader.SetGlobalTexture("test", texture);

There seems to be a caveat to using global textures.
If the meshrenderer becomes disabled, I think Unity ditches the global texture.
I was having a problem where the global texture was going blank.
So I set up another non-global texture in the shader (via shadergraph), and had that one use the same data.

Now the global data did not disappear if the object’s mesh renderer was disabled.

So next, I decided to make the texture public and static via script. That also seemed to be sure the information was not thrown away by memory management.