<!-- Page: https://rustic-game-engine.pages.dev/docs/api/environment -->

# Scene environment

Read and change sky textures, ambient and sun lighting, and haze from every script language.

[Feature status and language/platform compatibility](https://rustic-game-engine.pages.dev/markdown/reference/compatibility.md)

Choose an API to see its signature, parameters, examples and behavior.

## APIs

- [Game.scene.getEnvironment()](https://rustic-game-engine.pages.dev/markdown/api/environment/get-environment.md)
- [Game.scene.setEnvironment()](https://rustic-game-engine.pages.dev/markdown/api/environment/set-environment.md)
- [Game.scene.setSkyTexture()](https://rustic-game-engine.pages.dev/markdown/api/environment/set-sky-texture.md)

## Module guide

## When to call it

Call during Start or a later gameplay callback. Attach a scene startup or object component script, copy panoramas into the project before Play, and enable the environment. See [Sky & atmosphere](https://rustic-game-engine.pages.dev/markdown/guides/scene-environment.md) for complete setup and all 13 fields.

## Variables

| Variable | Type | Required | Description |
| --- | --- | --- | --- |
| `settings` | partial settings object | Yes | enabled, sky_image, sky_color, rotation_degrees, exposure, ambient_color, ambient_intensity, sun_color, sun_intensity, sun_direction, haze_color, haze_density, haze_start. Omitted fields retain current values. |
| `path` | project-relative string | Yes | 2:1 HDR, PNG, JPEG or TGA panorama present in the play snapshot. Empty clears the image. |
| `field` | setting name (C) | Yes | C reads/writes one typed field per call. |

## Return and timing

Live settings as a fresh object. Partial updates validate and commit atomically and return the resulting settings; C reads return RusticValue and C setters return void.

## Constraints and behavior

- Unknown settings and invalid values raise errors without mutating the environment. Exposure is limited to [-20,20]; colors/intensities/distances must be finite and non-negative; sun direction must be finite and nonzero.
- setSkyTexture changes only the image; set enabled=true separately. The renderer checks the image on the next frame. The panorama does not generate image-based lighting or reflections.
- Changes affect the running scene and do not save to the editor or appear in Apply Runtime Changes. Restart Play to restore authored settings.
- Every gameplay language calls the engine-owned API. Rustic supplies SDKs and dispatches callbacks; scripts do not parse requests or serialize responses. See the language guide for complete setup and callback registration.
