public Color GetPixel (CubemapFace face, int x, int y);

Description

返回坐标 (face, x, y) 上的像素颜色。

如果这些像素坐标超出边界(大于宽度/高度或小于 0), 则将被限制或者将根据该纹理的包裹模式进行重复。

The texture must have the Is Readable flag set in the import settings, otherwise this method will fail. GetPixel is not available on Textures using Crunch texture compression.

using UnityEngine;

public class Example : MonoBehaviour { public Cubemap texture;

void Start() { // prints the color of the pixel at (0,0) of the +X face Debug.Log(texture.GetPixel(CubemapFace.PositiveX, 0, 0)); } }