找回密碼
 注冊帳號

掃一掃,訪問微社區

camera.onwillrenderobject 在渲染物體之前

2015-1-4 04:37| 發布者: 楊炎| 查看: 2662| 評論: 0|原作者: 蠻牛|來自: unity3d腳本manual

摘要: camera.onwillrenderobject 在渲染物體之前functiononwillrenderobject() : voiddescription描述onwillrenderobject is called once for each camera if the object is visible.如果物體可見,每個相機都會調用onwil ...

camera.onwillrenderobject渲染物體之前

functiononwillrenderobject() : void

description描述

onwillrenderobject is called once for each camera if the object is visible.

如果物體可見,每個相機都會調用onwillrenderobject。

the function is called during the culling process just before rendering all culled objects. you might use this to create dependent render textures and you want to update the render texture only if the rendered object will actually be visible. as an example this is used by the water component.

這個函數在消隱過程中調用,在渲染所有被消隱的物體之前被調用。可以用這個來創建具有依賴性的渲染紋理,只有在被渲染的物體可見時才更新這個渲染紋理。作為一個例子,水組件就使用了這個。

camera.currentwill be set to the camera that will render the object.

camera.current將被設置為要渲染這個物體的相機。

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

publicgameobjectotherobject;

void onwillrenderobject() {

otherobject.transform.localscale *= 1.0001f;

}

}

// increases the size of otherobject while this transform is being rendered.

//增加otherobject的大小同時這個變換正在渲染

// be aware that this will be called even if the scene editor displays the object

//注意這個將被調用即使場景編輯器顯示這個物體

// so make sure to not see the object either in the game view nor the scene editor.

//因此,請確保在游戲視圖看不到的物體,不在場景編輯器

var otherobject :gameobject;

function onwillrenderobject() {

otherobject.transform.localscale *= 1.0001;

}

相關閱讀

文章點評
相關文章
女校游泳队彩金