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

Prefab previews and shaders

Discussion in 'Scripting' started by DryerLint, Jul 30, 2019.

  1. DryerLint

    DryerLint

    Joined:
    Feb 7, 2016
    Posts:
    68
    I've written a custom point cloud shader that requires some uniforms (vectors representing the screen frustum) to be passed to it before a frame can be rendered properly. Typically, I would do this in MonoBehavior.OnPreRender().

    All of the Prefabs that depend on this shader have non-existent preview images. Is there any way I could override the preview rendering with my own custom solution, or at least access the preview camera's equivalent to OnPreRender()?

    I speak of the preview window that usually appears immediately below the Inspector area when examining Prefabs or other Mesh-based objects.

    Thanks!