Version: 5.5

RenderTexture

class in UnityEngine

/

다음으로부터 상속:Texture

매뉴얼로 전환

설명

Render textures are textures that can be rendered to.

They can be used to implement image based rendering effects, dynamic shadows, projectors, reflections or surveillance cameras.

One typical usage of render textures is setting them as the "target texture" property of a Camera (Camera.targetTexture), this will make a camera render into a texture instead of rendering to the screen.

Another use case is manually implementing various rendering effects, for example Image Effects. There you often get temporary short-lived render textures (GetTemporary and ReleaseTemporary functions), and manually render objects into them (see Graphics.DrawMeshNow and Graphics.Blit).

Keep in mind that render texture contents can become "lost" on certain events, like loading a new level, system going to a screensaver mode, in and out of fullscreen and so on. When that happens, your existing render textures will become "not yet created" again, you can check for that with IsCreated function.

As with other "native engine object" types, it is important to pay attention to the lifetime of any render textures and release them when you are finished using them with the Release function, as they will not be garbage collected like normal managed types.

See Also: Camera.targetTexture.

정적 변수

activeCurrently active render texture.

변수

antiAliasingThe antialiasing level for the RenderTexture.
autoGenerateMipsMipmap levels are generated automatically when this flag is set.
colorBufferColor buffer of the render texture (Read Only).
depthThe precision of the render texture's depth buffer in bits (0, 16, 24/32 are supported).
depthBufferDepth/stencil buffer of the render texture (Read Only).
dimensionDimensionality (type) of the render texture.
enableRandomWriteEnable random access write into this render texture on Shader Model 5.0 level shaders.
formatThe color format of the render texture.
heightThe height of the render texture in pixels.
sRGBDoes this render texture use sRGB read/write conversions (Read Only).
useMipMapRender texture has mipmaps when this flag is set.
volumeDepthVolume extent of a 3D render texture.
widthThe width of the render texture in pixels.

생성자

RenderTextureCreates a new RenderTexture object.

Public 함수

CreateActually creates the RenderTexture.
DiscardContentsDiscards the contents of the RenderTexture.
GenerateMipsGenerate mipmap levels of a render texture.
GetNativeDepthBufferPtrRetrieve a native (underlying graphics API) pointer to the depth buffer resource.
IsCreatedIs the render texture actually created?
MarkRestoreExpectedIndicate that there's a RenderTexture restore operation expected.
ReleaseReleases the RenderTexture.
SetGlobalShaderPropertyAssigns this RenderTexture as a global shader property named propertyName.

정적 함수

GetTemporaryAllocate a temporary render texture.
ReleaseTemporaryRelease a temporary texture allocated with GetTemporary.
SupportsStencilDoes a RenderTexture have stencil buffer?

상속된 멤버

변수

hideFlagsShould the object be hidden, saved with the scene or modifiable by the user?
nameThe name of the object.
anisoLevelAnisotropic filtering level of the texture.
dimensionDimensionality (type) of the texture (Read Only).
filterModeFiltering mode of the texture.
heightHeight of the texture in pixels. (Read Only)
mipMapBiasMip map bias of the texture.
widthWidth of the texture in pixels. (Read Only)
wrapModeWrap mode (Repeat or Clamp) of the texture.

Public 함수

GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the game object.
GetNativeTexturePtrRetrieve a native (underlying graphics API) pointer to the texture resource.

정적 함수

DestroyRemoves a gameobject, component or asset.
DestroyImmediateDestroys the object obj immediately.
DontDestroyOnLoadMakes the object target not be destroyed automatically when loading a new scene.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsOfTypeReturns a list of all active loaded objects of Type type.
InstantiateClones the object original and returns the clone.
SetGlobalAnisotropicFilteringLimitsSets Anisotropic limits.

연산자

boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.