Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CubemapArray

Class for handling Cubemap arrays.
Read time 7 minutesLast updated 2 days ago

Definition

  • Type: Class
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
  • Inherits from: Texture
public sealed class CubemapArray : Texture

Remarks

Modern graphics APIs, such as D3D10.1 and later, OpenGL 4.0 and later, and Metal on macOS support cubemap arrays, which are arrays of cubemaps with same size and format. From the shader side, they are treated as a single resource, and sampling them needs an extra coordinate that indicates which array element to sample from.
Typically cubemap arrays are useful for implementing efficient reflection probe, lighting and shadowing systems (all reflection/cookie/shadow cubemaps in a single array).
Cubemap arrays do not have an import pipeline for them, and must be created from code, either at runtime or in editor scripts. Using Graphics.CopyTexture is useful for fast copying of pixel data from regular Cubemap textures into elements of a cubemap array. From editor scripts, a common way of creating serialized cubemap array is to create it, fill with data (either via Graphics.CopyTexture from regular cubemaps, or via CubemapArray.SetPixels or CubemapArray.SetPixels32) and save it as an asset via AssetDatabase.CreateAsset.
Note that not all platforms and GPUs support cubemap arrays. Use SystemInfo.supportsCubemapArrayTextures to check. Also, this class does not support CubemapArray creation with a Crunch compression TextureFormat.

Constructors

Properties

Property

Description

cubemapCountNumber of cubemaps in the array (Read Only).
formatTexture format (Read Only).

Methods

Method

Description

ApplyCopies changes you've made in a CPU texture to the GPU.
CopyPixelsCopies pixel data from another texture on the CPU.
GetPixelDataGets the raw data from a texture.
GetPixelsGets the pixel color data for a mipmap level of a face of a slice as Color structs.
GetPixels32Gets the pixel color data for a mipmap level of a face of a slice as Color32 structs.
SetPixelDataSets the raw data of an entire mipmap level of a face directly in CPU memory.
SetPixelsSets the pixel colors of an entire mipmap level of a face of a slice.
SetPixels32Sets the pixel colors of an entire mipmap level of a face of a slice.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.