Class SceneTerrainBake
Holds a scene's TerrainDetailBake on a client-only object at its root (ObjectName), and lists every loaded scene's while enabled, so the client's grass and detail scatter can find a terrain's baked maps (TileOf(TerrainData, out TerrainDetailBake)), the array terrain its stored index map (IndexOf(TerrainData)), and the grass a texture set's colour copy (AlbedoOf(Texture2DArray)).
[DisallowMultipleComponent]
public sealed class SceneTerrainBake : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourSceneTerrainBake
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Remarks
Under a ClientOnlyObject, so server builds drop it and the bake with it. The editor never enables it (it is not an edit-mode script): the bake is only looked up in play.
Fields
Bake
[Tooltip("The scene's baked grass and detail scatter maps (written by the cut).")]
public TerrainDetailBake Bake
Field Value
ObjectName
The name of the object carrying this, at the scene's root.
public const string ObjectName = "Terrain Detail Bake"
Field Value
Methods
AlbedoOf(Texture2DArray)
A loaded scene's baked colour copy of a texture set's albedo array, or null.
public static TerrainDetailBake.Albedo AlbedoOf(Texture2DArray source)
Parameters
sourceTexture2DArray
Returns
GroundOf(IReadOnlyList<Terrain>)
The baked ground colour map made over exactly these terrains (the same data, standing where they stood), from a loaded scene of this Version, not stale; null when there is none.
public static TerrainDetailBake.GroundColour GroundOf(IReadOnlyList<Terrain> terrains)
Parameters
terrainsIReadOnlyList<Terrain>
Returns
IndexOf(TerrainData)
The stored index map of a terrain's data (TerrainDetailBake.IndexMap) in any loaded scene's bake, when it may be drawn on that data (UsableFor(TerrainData)); null otherwise. Play only (the holder registers in play). Independent of the bake's Version and of the tile's own staleness, which are the grass's and the scatter's.
public static TerrainDetailBake.IndexMap IndexOf(TerrainData data)
Parameters
dataTerrainData
Returns
Remarks
A holder whose OnEnable has not run yet (a binder binding from its own OnEnable while the scene loads) is found among the loaded objects instead, so the first push of a scene already sees its maps.
TileOf(TerrainData, out TerrainDetailBake)
The usable baked entry for a terrain's data in any loaded scene, and that scene's bake; null when there is none, it was baked by another Version, or it was marked stale.
public static TerrainDetailBake.Tile TileOf(TerrainData data, out TerrainDetailBake bake)
Parameters
dataTerrainDatabakeTerrainDetailBake