Cubemap.GetPixel 获取像素颜色

function GetPixel (face : CubemapFace, x : int, y : int) : Color


Returns pixel color at coordinates (face, x, y).

返回所在坐标(face, x, y)处的样式颜色。

If the pixel coordinates are out of bounds (larger than width/height or small than 0), they will be clamped or repeat based on the texture's wrap mode.


The texture must have the Is Readable flag set in the import settings, otherwise this function will fail.


using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public Cubemap c;
	public void Awake() {
		Debug.Log(c.GetPixel(CubemapFace.PositiveX, 0, 0));
// prints the color of the pixel at (0,0) of the +X face
//打印x面像素所在(0,0) 处的颜色

var c : Cubemap;
Debug.Log(c.GetPixel(CubemapFace.PositiveX, 0, 0));
Page last updated: 2011-3-18