首页 > 编程语言 > 详细

unity, Graphics.Blit (null, null, mat,0);

时间:2016-04-28 15:23:01      阅读:342      评论:0      收藏:0      [点我收藏+]

我使用

Graphics.Blit (null, finalRT, mat);

合成出一张finalRT,然后将finalRT用在editor脚本的OnInspector中使用

Graphics.DrawTexture(rect,finalRT,mat2);

进行绘制,结果发现m_finalRT显示结果是错的,而且在游戏场景中用到finalRT作为纹理的物理纹理也变错了。

但是如果我屏蔽掉Graphics.DrawTexture(rect,finalRT,mat2),则游戏场景中用finalRT作为纹理的对象不会变错,但是当然,我在inspector中就看不到finalRT的预览了。

通过试验发现,如果在Graphics.Blit (null, finalRT, mat)后面紧跟着加一句:

#if UNITY_EDITOR
        Graphics.Blit (null, null, mat,0);//if i want to draw finalRT with a shader in editor script, i must write this line, why?
# endif

则结果就正常了。

不知道为啥。

unity, Graphics.Blit (null, null, mat,0);

原文:http://www.cnblogs.com/wantnon/p/5442773.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!