Skip to content

ValterGames-Coder/Unity-Rotatable-Skybox-Shader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Unity-Rotatable-Skybox-Shader

How use in code:

using UnityEngine;

public class SkyboxRotate : MonoBehaviour
{
    #region --- Variables ---

    [SerializeField] private Material skyboxMaterial;
    [SerializeField] private float rotateSpeed;
    private float _rotation;

    #endregion

    #region --- Unity Methods ---
    private void LateUpdate()
    {
        _rotation = (Time.time * rotateSpeed) % 360; // Smooth change rotate from 0 to 360 degree
        skyboxMaterial.SetFloat("_RotationX", _rotation);
        skyboxMaterial.SetFloat("_RotationY", _rotation);
        skyboxMaterial.SetFloat("_RotationZ", _rotation);
    }

    #endregion
}

About

A simple skybox shader with the ability to rotate it along 3 axes

Resources

Stars

Watchers

Forks

Contributors