Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Is the "OnRenderObject()" method compatible with HDRP?

Discussion in 'High Definition Render Pipeline' started by marcos4503, Mar 6, 2021.

  1. marcos4503

    marcos4503

    Joined:
    Nov 1, 2015
    Posts:
    76
    I'm working on a project where I need to run some code whenever the camera renders my GameObject, so I'm using "OnRenderObject()" for that.

    While in scene view, the method works normally, and the code is executed.
    When I run my game, the "OnRenderObject()" method just stops working.

    Every help is welcome.
    Thank you for your time.
     
  2. marcos4503

    marcos4503

    Joined:
    Nov 1, 2015
    Posts:
    76
    I just found this documentation and it says that "OnRenderObject()" is not supported in HDRP (only in URP and Built-in as far as I can see)

    https://docs.unity3d.com/Packages/c...efinition@10.3/manual/Feature-Comparison.html

    Does anyone know if there is a forecast to support this Hook in the future? (Maybe a link to some topic/blog where Unity refers to it, unfortunately I couldn't find anything with the keywords I used)

    Again, any help is welcome!
     
  3. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    If you need to do some code when object is visible through camera - just check if object is inside camera frustum with GeometryUtility.CalculateFrustumPlanes and GeometryUtility.TestPlanesAABB
     
    ignarmezh likes this.
  4. marcos4503

    marcos4503

    Joined:
    Nov 1, 2015
    Posts:
    76
    I understand! Thanks for the help!