Swap 2 Skyboxes with single button

Hi everyone!
Im trying to build a world where i can toggle a day and night mode. I already got a button that alternate between 2 directional lights that have 2 different temperatures. The only thing im missing is the actual skybox. I know it can’t be done but I’ve spend at least 5-6 hours trying to figure it out. It seems natively you can only apply a single skybox. I was wondering if there’s an option somewhere or a shader i must use (if so, where can i get it). I can’t seem to find any info on creating a button that can alternate between each

Anybody out there knows how to do it?
Thanks in advance

You have two options.

  1. You modifiy the Material properties on a custom Skybox shader.
  2. You can set the skybox material to a different material using the RenderSettings.set skybox node

Do you have an example i can use using the render settings? I dont know how to use this node. I have a material variable ready for my 2 skyboxes. I know how to make it verify so it can toggle it on and off on the same button depending on its current state

Alright i tried making 2 C# script that i toggle on and off alternatively. One script is for day and set to an empty gameObject and one is for night. I have a button the toggle inbetween eachother by setting the empty gameObject active/inactive. It does work inside unity but when i upload to VRC and test, the skyboxes just dont show up and wont toggle. Im losing my mind…

Code for day

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DaySkybox : MonoBehaviour
{

public Material skyDay;
public Material skyNight;

// Start is called before the first frame update
void Start()
{
    RenderSettings.skybox = skyDay;
    DynamicGI.UpdateEnvironment();
}

// Update is called once per frame
void Update()
{
    DynamicGI.UpdateEnvironment();
}

}

Code for night

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NightSkybox : MonoBehaviour
{
public Material skyDay;
public Material skyNight;

// Start is called before the first frame update
void Start()
{
    RenderSettings.skybox = skyNight;
    
}

// Update is called once per frame
void Update()
{
    DynamicGI.UpdateEnvironment();
}

}