VaM 1.x Changing skybox with UIButton

Threads regarding the original VaM 1.x

Pavel M.

Member
Joined
Jan 12, 2026
Messages
30
Reactions
4
Hi, i really didn't know what to search to find this, i wanted to change the skybox with a UIButton, with "SkyBox" i mean this:
1774728424190.png

the "SkyEpicCentreOfTheStorm" button, that one, is there any way of doing this? I know i could use a CUA and just change the asset but i prefer the default skyboxes. Thanks in advance!
 
I believe there is no built-in way to change the skybox via triggers. Not sure if there is already a plugin for it, but it would be as simple as the following script. You can target the Sky, Previous, and Next params in your button trigger to choose a specific sky or cycle through them.
C#:
using System.Linq;

public class SkyChooser : MVRScript
{
    private JSONStorableStringChooser sky;
    private JSONStorableAction previous;
    private JSONStorableAction next;

    public override void Init()
    {
        sky = new JSONStorableStringChooser(
            "Sky",
            SkyshopLightController.singleton.skies.Select(s => s.name).ToList(),
            SkyshopLightController.singleton.skyName,
            "Sky",
            skyName => SkyshopLightController.singleton.skyName = skyName
        );
        RegisterStringChooser(sky);
        CreateScrollablePopup(sky);

        previous = new JSONStorableAction("Previous", () => SetNextSkybox(-1));
        RegisterAction(previous);
        previous.dynamicButton = CreateButton(previous.name);

        next = new JSONStorableAction("Next", () => SetNextSkybox(1));
        RegisterAction(next);
        next.dynamicButton = CreateButton(next.name);
    }

    private void SetNextSkybox(int direction)
    {
        int index = sky.choices.IndexOf(sky.val);
        if (index == -1) { index = 0; }
        int count = sky.choices.Count;
        index = (index + direction + count) % count;
        sky.val = sky.choices[index];
    }
}
 
I believe there is no built-in way to change the skybox via triggers. Not sure if there is already a plugin for it, but it would be as simple as the following script. You can target the Sky, Previous, and Next params in your button trigger to choose a specific sky or cycle through them.
C#:
using System.Linq;

public class SkyChooser : MVRScript
{
    private JSONStorableStringChooser sky;
    private JSONStorableAction previous;
    private JSONStorableAction next;

    public override void Init()
    {
        sky = new JSONStorableStringChooser(
            "Sky",
            SkyshopLightController.singleton.skies.Select(s => s.name).ToList(),
            SkyshopLightController.singleton.skyName,
            "Sky",
            skyName => SkyshopLightController.singleton.skyName = skyName
        );
        RegisterStringChooser(sky);
        CreateScrollablePopup(sky);

        previous = new JSONStorableAction("Previous", () => SetNextSkybox(-1));
        RegisterAction(previous);
        previous.dynamicButton = CreateButton(previous.name);

        next = new JSONStorableAction("Next", () => SetNextSkybox(1));
        RegisterAction(next);
        next.dynamicButton = CreateButton(next.name);
    }

    private void SetNextSkybox(int direction)
    {
        int index = sky.choices.IndexOf(sky.val);
        if (index == -1) { index = 0; }
        int count = sky.choices.Count;
        index = (index + direction + count) % count;
        sky.val = sky.choices[index];
    }
}
Thank you some much!
 
Back
Top Bottom