Cubemap.SetPixel 设置像素颜色

function SetPixel (face : CubemapFace, x : int, y : int, color : Color) : void


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

设置所在坐标(face, x, y)处的像素颜色。

Call Apply to actually upload the changed pixels to the graphics card. Uploading is an expensive operation, so you'll want to change as many pixels as possible between Apply calls.

调用Apply来实际上载改变后的像素到显卡, 上载是非常耗时的操作,因此你要在Apply调用之间改变尽可能多的像素。

This function works only on ARGB32, RGB24 and Alpha8 texture formats. For other formats SetPixel is ignored.


参见:Apply 函数

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public Cubemap c;
	public void Awake() {
		c.SetPixel(CubemapFace.PositiveX, 0, 0,;
// Set the pixel at (0,0) of the +X face red.
var c : Cubemap;
c.SetPixel(CubemapFace.PositiveX, 0, 0,;
// Apply the color to the face.
Page last updated: 2011-3-18