Support for OnPreRender and OnPostRender Events in Udon for the VRChat Camera/Drone
Quap
It would be very helpful to have access to OnPreRender and OnPostRender events in Udon for the VRChat Camera/Drone, so we can manipulate the scene at those specific stages of the rendering.
For example, in my worlds Jetski Islet and Jetski Rush, I would like to move the water mesh to follow the drone camera during OnPreRender and reset it during OnPostRender to the player position. This would allow for high-detail water rendering for both the player view and the external drone/camera view.
Log In
BobyStar
We now have VRCCameraSettings.GetCurrentCamera in open beta that lets you see if it's the screen/vrview, photo/drone camera, or another world camera (Note that OnPre/PostRender only work on an object with the camera component, as per Unity docs):
```cs
// Needs to be on an object with a Renderer (Sprite, Mesh, SkinnedMesh, etc)
private void OnWillRenderObject()
{
VRCCameraSettings.GetCurrentCamera(out VRCCameraSettings vrcCameraSettings, out Camera worldCamera);
// Skip if both are invalid.
if (!Utilities.IsValid(worldCamera) && !Utilities.IsValid(vrcCameraSettings))
return;
if (Utilities.IsValid(worldCamera))
Debug.Log($"World Camera Rendering! {worldCamera}");
else // Logic knows vrcCameraSettings is already valid, no need to recheck.
Debug.Log($"VRC Camera Rendering! {vrcCameraSettings}");
}
```