private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
public static void UpdateSkybox(Material material) { SkyboxLoader.SetSkybox(material); if (SceneReflection == null) { var reflectionObject = new GameObject(); var sceneReflection = reflectionObject.AddComponent <ReflectionProbe>(); } SceneReflection.size = new Vector3(5000f, 5000f, 5000f); SceneReflection.mode = UnityEngine.Rendering.ReflectionProbeMode.Baked; SceneReflection.farClipPlane = 0.02f; SceneReflection.nearClipPlane = 0.01f; SceneReflection.mode = UnityEngine.Rendering.ReflectionProbeMode.Realtime; SceneReflection.refreshMode = UnityEngine.Rendering.ReflectionProbeRefreshMode.ViaScripting; SceneReflection.RenderProbe(); }