Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by ju_my · Aug 24, 2018 at 11:04 AM · camerarenderingdebuggingonpostrender

OnpostRender is not called

Hi, i have this script attached to my camera:

public class Test : MonoBehaviour {

 private void OnPostRender()
 {
     Debug.Log("ok");
 }

}

But Nothing get debugged, i don't anderstand why. Everything is of course enabled, and just one camera in my scene.

Edit: I found that it works if i set no render pipeline in graphics settings. But i need it for shadergraphs!

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hellium · Aug 24, 2018 at 11:26 AM 0
Share

Are you sure the script is attached on the CA$$anonymous$$ERA?

$$anonymous$$onoBehaviour.OnPostRender()

Description

OnPostRender is called after a camera finished rendering the scene.

This function is called only if the script is attached to the camera and is enabled.

avatar image ju_my · Aug 24, 2018 at 11:50 AM 0
Share

Yes i am. And when i set no render pipeline in graphics settings, it's calling. But if i set a LWRP it dosen't. I'm looking for why, but i find nothing related with renderPipelines and OnPostRender function

avatar image Hellium ju_my · Aug 24, 2018 at 12:21 PM 1
Share

It seems like the error has been reported to Unity :

https://forum.unity.com/threads/feedback-wanted-lightweight-render-pipeline.518267#post-3397752

avatar image ju_my · Aug 24, 2018 at 01:20 PM 1
Share

A dev wrote here: https://forum.unity.com/threads/feedback-wanted-scriptable-render-pipelines.470095/page-8

Removing Camera Rendering Callbacks As pre-SRP Unity stands there are a number of callbacks issued to sibling scripts of a Camera component; specifically:

 OnPreCull
 OnPreRender
 OnPostRender
 OnRenderImage

As these callbacks stand they offer ways to inject extra rendering code into Unity. The issue that arises when attempting to port these to SRP world is multifaceted.

4 Replies

· Add your reply
  • Sort: 
avatar image
21

Answer by arminelec · Sep 09, 2018 at 04:28 PM

Update (2020-02-10):

The new SRP ( URP and HDRP) system is no longer experimental, so I thought I would update my answer for anyone still interested in this matter. In this update I am using RenderPipelineManager instead of RenderPipeline and included the comments from the previous reply into account. (To see the original answer, please use the gear icon -> revision history).

 using UnityEngine;
 using UnityEngine.Rendering;

 public class MyClass: MonoBehaviour
 {
     void OnEnable()
     {
         RenderPipelineManager.endCameraRendering += RenderPipelineManager_endCameraRendering;
     }

     void OnDisable()
     {
         RenderPipelineManager.endCameraRendering -= RenderPipelineManager_endCameraRendering;
     }

     private void RenderPipelineManager_endCameraRendering(ScriptableRenderContext context, Camera camera)
     {
         OnPostRender();
     }
 
     private void OnPostRender()
     {
        // Your already existing code
     }
 }
Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image RunninglVlan · May 03, 2019 at 02:01 PM 1
Share

Comment to the previous version of answer: As far as I know, equivalent of OnPostRender in SRP is RenderPipeline$$anonymous$$anager.endCameraRendering

using UnityEngine.Rendering

avatar image rsodre RunninglVlan · Jun 10, 2019 at 12:06 AM 0
Share

Points to the right direction, but the correct answer should use the event described by @RunninglVlan.

avatar image BradZoob · Mar 11, 2020 at 07:53 PM 0
Share

What is gear icon -> revision history ?

avatar image arminelec BradZoob · Mar 13, 2020 at 03:24 PM 0
Share

The gear icon is on the right hand side of the title of any answer in Unity forums. It is visible when logged in and clicking it shows a menu. If you click it and only see a "Report" option, then it means that I made a mistake (and the revision history is only visible to me). In that case, I will update my answer and will remove the sentence about the old answer.

avatar image NatCracken · Sep 29, 2020 at 12:34 AM 0
Share

I don't know if they Unity changed something, but the gear icon and revision history is now only available to the original poster. Unity still hasn't officially deprecated the OnPostRender function, despite it no longer being called if you ever so much as poke at the post processing stack, and this thread now comes up at the top of searches for this issue. Would you be able to re-add your alternate solutions back into the main post to help people like me stuck in limbo between the old render pipeline and srp?

avatar image
0

Answer by ju_my · Nov 20, 2018 at 01:40 PM

Thanks you very much, it seems to work! But GL.Lines are not rendering

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by BahamutGundam · Jul 16, 2019 at 02:22 AM

RenderPipeline.beginCameraRendering() is also an alternative.

Unlike RenderPipeline.beginFrameRendering() which receives Camera[] as parameters, RenderPipeline.beginCameraRendering() only receives one Camera object as a parameter, and therefore you can check which camera you would like to apply your code onto.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by ccvannorman · Jun 18, 2020 at 06:20 PM

Can you please explain how to get GL Lines to show up for Oculus Quest? I do not understand what you mean by this statement

..

"RenderPipeline.beginCameraRendering() only receives one Camera object as a parameter, and therefore you can check which camera you would like to apply your code onto."

..

Is there specific code which you can share which gets GL LInes to show up for Camera.main in Quest?

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image RunninglVlan · Jun 19, 2020 at 07:18 AM 0
Share

You're asking a question in your answer. This is not how it works. If you have a comment to somebody's answer, click on Add comment under that answer. But you're mentioning Oculus Quest here, which original question wasn't about, so I think it's better to Create a new question by clicking on Ask a question mentioning your problem.

avatar image BahamutGundam RunninglVlan · Jun 20, 2020 at 09:47 AM 0
Share

But you're mentioning Oculus Quest here, which original question wasn't about, so I think it's better to Create a new question by clicking on Ask a question mentioning your problem.

I agree with this.

Anyways, to answer the question, my comment on "RenderPipeline.beginCameraRendering()" is about it being an alternative of "OnPostRender()", which is what the original question asked. It is not necessarily related to GL Lines, nor Oculus Quest.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

159 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

3D Objects are not being in their regular shape at distance 2 Answers

Best way to access RenderTexture immediately after camera render 0 Answers

Capture a Screenshot Through a Camera in the Lightweight Render Pipeline 1 Answer

Canvas Rendering Execution Order Question 0 Answers

Unity - Render XR game objects onto processed camera image 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges