Version: 2021.1

DefaultFormat

enumeration

切换到手册

描述

使用默认格式根据特定于平台的功能从脚本创建纹理或 RenderTextures。

using UnityEngine;
using UnityEngine.Experimental.Rendering;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { // Create a new texture and assign it to the material of the renderer. Texture2D texture = new Texture2D(1, 1, DefaultFormat.LDR, TextureCreationFlags.None); GetComponent<Renderer>().material.mainTexture = texture; } }

每个图形卡可能并不支持跨格式的所有用法。使用 SystemInfo.IsFormatSupported to check which usages the graphics card supports. See Also: Texture2D, 纹理资源

变量

LDR表示特定于平台的默认 LDR 格式。如果项目使用线性渲染模式,则实际格式为 sRGB。如果项目使用伽马渲染模式,则实际格式为 UNorm。
HDR表示特定于平台的默认 HDR 格式。