简体   繁体   English

如何在Unity3d中的GameObject后面绘制GL占位符

[英]How to draw GL premitives behind GameObject in Unity3d

I have a question that I can't find in a documentation. 我有一个在文档中找不到的问题。 I use GL premitives to draw grid. 我使用GL谓词绘制网格。 But I can't understand how to push it behind gameObjects. 但是我不明白如何将其推到gameObjects之后。 Now grid is drawing on main Camera in OnRenderObject, and as result I see grid in front of gameObjects. 现在网格在OnRenderObject中的主Camera上绘制,结果我在gameObjects前面看到了网格。 If I draw it in Update or LateUpdate the grid is visible only in Scene mode. 如果我在Update或LateUpdate中绘制它,则该网格仅在“场景”模式下可见。 So, please, tell me what options do I have? 所以,请告诉我我有哪些选择?

Looking over the documentation ... 查看文档 ...

I see... 我懂了...

  • OnPreRender - OnPreRender is called before a camera starts rendering the scene. OnPreRender-在相机开始渲染场景之前调用OnPreRender。
  • OnWillRenderObject - OnWillRenderObject is called for each camera if the object is visible and not a UI element. OnWillRenderObject-如果对象可见而不是UI元素,则为每个摄像机调用OnWillRenderObject。

Both of these fire before anything renders. 这两件事在任何事情发生之前就已经开火了。 Whereas the method you're using now has this description: 而您正在使用的方法现在具有以下说明:

OnRenderObject is called after camera has rendered the scene. 相机渲染场景调用OnRenderObject。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM