
星空をエミッションで光らせて、スクリプトで簡単に回転させてみます。
まずPhotoshopなどで適当に白黒の星空画像を作ってUnityでCubeマップにします。


Volumeコンポーネントが付いたオブジェクトを作ってGlobalモードにし、ProfileがなければNewをクリックして新しく作って、Add Override -> Sky からPhysically Based Skyを選択します。

Spaceの項目全てにチェックを入れて、Space Emission Textureに上のCubeマップをアタッチします。

すると空に星が現れます。Space Emission Multiplierを上げると、白い部分がより明るく光ります。



下のPlaneにも星空が映っています。


Spece Rotationで画像を回転させられます。Y軸を動かすと水平に回転するようです。



スクリプトでこの値を変更してみます。空のゲームオブジェクトに以下のスクリプトを付けます。
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering;
public class VolumeTestScript : MonoBehaviour
{
[SerializeField] Volume volume;
PhysicallyBasedSky sky;
float sec;
Vector3 rot;
// Start is called before the first frame update
void Start()
{
// PhysicallyBasedSkyを取得
PhysicallyBasedSky pbs;
if (volume.profile.TryGet(out pbs))
{
sky = pbs;
}
// volume.profile.TryGet(out sky);
rot = sky.spaceRotation.value; // デフォルトの回転
}
// Update is called once per frame
void Update()
{
// 時間と共に回転
sec = Time.deltaTime;
rot.x += sec * 1.3f;
rot.y += sec * 2;
rot.z += sec * -1.1f;
sky.spaceRotation.value = rot;
}
}
まず、上で設定したVolumeコンポーネントからPhysicallyBasedSkyを取得します。volume.profile.TryGet(out sky);と書いても動きました。
Volumeコンポーネントの付いたオブジェクトをインスペクタにアタッチしておきます。

そして、現在の回転値を変数にいれます。spaceRotationの値はVector3Parameter型ですが、valueメンバにはVector3型の値が入っています。
このx,y,zにUpdate()でそれぞれTime.deltaTimeを足して、値を増減させます。それをspaceRotation.valueに戻します。
これで星空を回転させることができました。